1 solutions

  • 0
    @ 2025-12-3 17:42:15

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    string n;
    long long k;
    int main()
    {
    	cin>>n>>k;
    	while(k--)
    	{
    		for(int i=0;i<n.size();i++)
    		{
    			if(n[i]>n[i+1])
    			{
    				n.erase(i,1);
    				break;
    			}
    		}
    	}
    	while(n[0]=='0'&&n.size()>1)
    		n.erase(0,1);
    	cout<<n;
       return 0;
    }
    
    
    • 1

    Information

    ID
    1012
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    10
    Tags
    # Submissions
    4
    Accepted
    4
    Uploaded By