Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|---|
228117 | 顾欣薇 | 基础算法-贪心算法:删除问题 | C++ | Wrong Answer | 40 | 0 MS | 272 KB | 302 | 2024-01-02 20:47:56 |
#include <bits/stdc++.h> using namespace std; string str; int n,t; int main() { cin >>str; cin >> n; for (int i=0;i<str.size()-1&&t<n;i++) { if (str[i+1]<str[i]) { str.erase(i,1); i=-1; t++; } } if (t<n) { str.erase(str.size()-(n-t)); } cout <<str; return 0; }