提交时间:2025-07-15 10:33:11

运行 ID: 332709

#include<bits/stdc++.h> using namespace std; int main(){ char s[245]; int n,l,t; cin>>s>>n; l=strlen(s); sort(s,s+l); t=l-n; if(s[t-1]=='0'){ if(t==1){ cout<<0; return 0; }else{ for(int i=t; i<l; i++){ if(s[i]!='0'){ swap(s[i],s[0]); break; } } } } for(int i=0; i<t; i++){ cout<<s[i]; } return 0; }