3 条题解

  • 1
    @ 2025-10-19 8:17:36

    **# 😕 ** #include<bits/stdc++.h> using namespace std; string o,s; bool f=0; int k; int main(){ cin>>s>>k; for(int i=1;i<=k;i++){ int t=0; while(s[t]<=s[t+1]&&t<=s.size()-2)t++; s.erase(t,1); } int t=0; while(s[t]=='0'&&s.size()>1)s.erase(0,1); cout<<s; return 0; }

    • 1
      @ 2025-10-19 8:17:08

      #include<bits/stdc++.h> using namespace std; string o,s; bool f=0; int k; int main(){ cin>>s>>k; for(int i=1;i<=k;i++){ int t=0; while(s[t]<=s[t+1]&&t<=s.size()-2)t++; s.erase(t,1); } int t=0; while(s[t]=='0'&&s.size()>1)s.erase(0,1); cout<<s; return 0; }``````````````


      • -1
        @ 2022-12-3 21:48:28

        贪心贪心

        #include<bits/stdc++.h>
        using namespace std;
        (不提供快读)
        void write(int x) {
        	if(x<0){
        		putchar('-');
        		write(-x);
        		return;
        	}
        	if(x>=10)write(x/10);
        	putchar(x%10+'0');
        }
        int n,m,i,j,s;
        string a,b;
        int main()
        {
        	cin>>a;
           n=read();
        	for(i=1;i<=n;i++)
        		for(j=0;j<a.size();j++)
        			if(a[j]>a[j+1]||j+1==a.size())//大的或者是末尾的那个
        			{
        				a.erase(j,1);//删数,STL函数
        				break;
        			}
        	while(a.size()>1&&a[0]=='0')a.erase(0,1);//前导零
        	cout<<a;
        	return 0;
        }
        • 1

        信息

        ID
        236
        时间
        1000ms
        内存
        256MiB
        难度
        5
        标签
        (无)
        递交数
        320
        已通过
        116
        上传者