爆零
查看原帖
爆零
1264600
Lazy_make_name楼主2024/10/16 22:40
#include<iostream>
#include<stack>
using namespace std;
int main(){
	stack<char> s;
	stack<char> l;
	int k;
	string a;
	cin>>a>>k;
	s.push(a[0]);
	for(int i=1;i<a.size();i++){
		if(a[i]>s.top()&&k>0){
			s.pop();
			s.push(a[i]);
			k--;
		}
	}
	while(!s.empty()){
		l.push(s.top());
		s.pop();
	}
	while(!l.empty()){
		cout<<l.top();
		l.pop();
	}
} 
2024/10/16 22:40
加载中...