Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
228127 | 顾欣薇 | 基础算法-贪心算法:删除问题 | C++ | 通过 | 100 | 0 MS | 272 KB | 287 | 2024-01-02 22:22:45 |
#include <bits/stdc++.h> using namespace std; string n; int s; int main() { cin>>n>>s; for(int i=1;i<=s;i++) { int p=0; while(n[p]<=n[p+1]) { p++; } n.erase(p,1); } while(n[0]=='0'&&n.size()!=1) { n.erase(0,1); } cout<<n; return 0; }