Code
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n,k;
cin>>n>>k;
string s;
cin>>s;
sort(s.begin(),s.end());
reverse(s.begin(),s.end());
s.erase(n-k);
if(s.length()==0){
cout<<0<<"\n";
}
else{
cout<<s<<"\n";
}
}
}
Information
- Submit By
- Type
- Submission
- Problem
- P1006 A. Remove K Digits
- Language
- C++11 (G++ 13.2.0)
- Submit At
- 2025-08-04 06:02:27
- Judged At
- 2025-08-04 06:02:27
- Judged By
- Score
- 0
- Total Time
- 2ms
- Peak Memory
- 532.0 KiB