这个题就是把单调递增的读一个数删除;
代码如下:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<queue>
#define pi acos(-1)
#define For(i, a, b) for(int (i) = (a); (i) <= (b); (i) ++)
#define Bor(i, a, b) for(int (i) = (b); (i) >= (a); (i) --)
using namespace std;
typedef long long ll;
const int maxn = 100 + 10;
const int INF = 0x3f3f3f3f;
const double EPS = 1e-10;
const ll mod = 1e9 + 7;
inline int read(){
int ret=0,f=0;char ch=getchar();
while(ch>'9'||ch<'0') f^=ch=='-',ch=getchar();
while(ch<='9'&&ch>='0') ret=ret*10+ch-'0',ch=getchar();
return f?-ret:ret;
}
char a[maxn];
int n, k;
int main(){
ios::sync_with_stdio(false);
cin >> n >> k;
string s;
for(int i = 0; i < n; i++){
cin >> a[i];
s += a[i];
}
if(k == n)cout << 0 << endl;
else{
while(k){
int i;
for(i=0; i < s.size()-1&&s[i] >= s[i + 1];i++);
s.erase(i,1);
k--;
}
cout << s << endl;
}
return 0;
}
继续努力,充实自己。