#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
string n;
int k;
cin >> n >> k;
n += "0";
while (k--){
for (int i = 0; i < n.size()-1; i++){
if (n[i] > n[i+1]){
n.erase(i, 1);
break;
}
}
}
int check = 0, flag = 0;
while (n[check] == '0') check++;
for (int i = check; i < n.size()-1; i++){
cout << n[i];
flag = 1;
}
if (!flag) cout << "0";
return 0;
}
【洛谷】P1106 删数问题
最新推荐文章于 2021-08-28 16:59:19 发布