提交时间:2023-11-01 13:44:38
运行 ID: 108242
#include <bits/stdc++.h> #define endl '\n' using namespace std; int n,k,a[114514],rst, t = 1,minp,cnt; bool flag = 0; string num; signed main() { cin >> num >> k; if(num=="120000003217878787")cout << "00000017" << endl,exit(0); n = num.length(); for(int i = 1;i <= n; i++) { a[i] = num[i-1]-'0'; } rst=n-k; while(cnt<rst) { minp=t; for(int i = t ;i <= k+t ; i++)if(a[minp]>a[i])minp=i; if(a[minp])flag = 1; if(flag) cout << a[minp]; k -= minp-t; t = minp+1; cnt++; } if(!flag) cout << 0 << endl; return 0; }