58分求条,AC绝壁关
查看原帖
58分求条,AC绝壁关
1171448
zhby_Twd楼主2025/7/28 16:35
#include<bits/stdc++.h>
using namespace std;
/*
7000 2
*/
int main(){
	string s;
	int cnt;
	cin>>s>>cnt;
	int len=s.size(),i=0;
	while(cnt&&i<len){
		if(s[i-1]<s[i]&&s[i]>s[i+1]){
			cnt--;
			s.erase(i,1);
			i=0;
			continue;
		}
		i++;
	}
	while(s[0]=='0'&&s!="0"){
		s.erase(0,1);
	}
	cout<<s;
	return 0;
}

2025/7/28 16:35
加载中...