#include <bits/stdc++.h>
using namespace std;
stack<int> s;
int main() {
int n;
cin>>n;
while(n--)
{
int w;
cin>>w;
while(s.top() < w && !s.empty()) {
s.pop();
}
s.push(w);
}
while(!s.empty()) {
cout << s.top();
s.pop();
}
}
这个程序在输入数据的时候出现了蜜汁问题,无法输入。
求解决方案