Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
133680 | mairuisheng | 删数问题 | C++ | 解答错误 | 88 | 0 MS | 244 KB | 594 | 2024-03-02 08:56:24 |
#include<bits/stdc++.h> using namespace std; int main() { int s; string n,n1; cin>>n>>s; int ln=n.length(); string::iterator it=n.begin(); while(s) { int i=0; while(i<ln&&n[i]<=n[i+1]) { i++; } s--; n.erase(it+i); } int k=0; bool pd=false; for(int i=0;i<n.length();i++) { if(n[i]!='0') pd=true; if(n[i]!='0'||pd) {cout<<n[i]; k++; } } if(k==0) cout<<"0"; return 0; }