#include <bits/stdc++.h>
using namespace std;
#define MXN 1010
int n;
deque<char> q;
char num[MXN];
int main(){
while(scanf("%s %d", num, &n) == 2){
if(q.size() == 0) q.clear();//清空
q.push_back('0');//将0从队列后面压入(队中)
for(int i = 0; num[i] != '\0'; i++){
while(num[i] < q.back() && n > 0) q.pop_back(), n--;//删除对列中最后一个元素
q.push_back(num[i]);
}
while(n > 0) q.pop_front(), n--;
while(q.size() && q.front() == '0') q.pop_front();
if(q.size()){
while(q.size()){
printf("%c", q.front());
q.pop_front();
}
}
else printf("0");
printf("\n");
}
return 0;
}
```[添加链接描述](http://acm.hdu.edu.cn/showproblem.php?pid=3183)
08-12
08-12