提交时间:2023-11-02 13:31:05
运行 ID: 108353
//I am Block Xuan #include<bits/stdc++.h> //I am Block Xuan using namespace std; //I am Block Xuan int a[114514]; //I am Block Xuan vector <int> vec; //I am Block Xuan int main(){ //I am Block Xuan int n,k,lst = 1; //I am Block Xuan bool qdl = true; //I am Block Xuan string s; //I am Block Xuan cin>>s>>k; //I am Block Xuan n = s.size(); //I am Block Xuan if (k >= n){ //I am Block Xuan cout<<0; //I am Block Xuan return 0; //I am Block Xuan } //I am Block Xuan int x = n - k; //I am Block Xuan for (int i = 1;i <= n;i++){ //I am Block Xuan a[i] = s[i - 1] - '0'; //I am Block Xuan } //I am Block Xuan int maxi = 0; //I am Block Xuan while (x > 0){ //I am Block Xuan int maxn = 1919810; //I am Block Xuan for (int i = maxi + 1;i <= n - x + 1;i++){ //I am Block Xuan if (a[i] < maxn){ //I am Block Xuan maxn = a[i]; //I am Block Xuan maxi = i; //I am Block Xuan } //I am Block Xuan } //I am Block Xuan vec.push_back(a[maxi]); //I am Block Xuan x--; //I am Block Xuan } //I am Block Xuan if (vec.size() == 0){ //I am Block Xuan vec.push_back(0); //I am Block Xuan } //I am Block Xuan for (int i = 0;i < vec.size();i++){ //I am Block Xuan if (qdl && vec[i] == 0 && i != vec.size() - 1){ //I am Block Xuan continue; //I am Block Xuan } //I am Block Xuan cout<<vec[i]; //I am Block Xuan qdl = false; //I am Block Xuan } //I am Block Xuan return 0; //I am Block Xuan } //I am Block Xuan