Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|---|
227894 | 顾欣薇 | 基础算法-贪心算法:删除问题 | C++ | Wrong Answer | 20 | 0 MS | 276 KB | 318 | 2023-12-31 15:33:13 |
#include <bits/stdc++.h> using namespace std; int main() { string str; int n,t; cin >> str; cin >> n; t=n; for (int i=0;i<str.size();i++) { if (str[i]>str[i+1]&&t>0) { str[i]='?'; t--; } } for(int i=0;i<str.size();i++) { if (str[i]!='?') { cout << str[i]; } } return 0; }