Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
#include <bits/stdc++.h>
#define ll long long int
#define endl '\n'
using namespace std;
#define pb push_back
#define all(x) x.begin(), x.end()
ll k, kt ;string s ;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> s >> k ;
while (k > 0) {
kt = 0 ;
for ( ll i=0 ; i < s.size()-1 ; i++)
if ( s[i] < s[i+1]) {
s.erase(i,1) ;
kt=1 ;
k-- ;
break ;
}
if ( kt == 0) {
while ( k--) s.erase(s.size()-1,1) ;
}
}
cout << s ;
}
Hãy giúp mọi người biết câu trả lời này thế nào?
Sự kiện
2
37
0
bằng pascal được không ạ