题目链接:https://www.acwing.com/problem/content/description/832/
题目如下:
#include#include #include using namespace std; const int N=INT_MAX;//包含在头文件 中 int main(){ stack stk;//=new stack (N); int n,cnt; cin>>n; while(n--){ int x; cin>>x; while(stk.size()&&x<=stk.top()) stk.pop();//如果栈不为空,且栈顶元素比当前元素的值大,则需pop() if(stk.empty()) cout<<"-1"<<" "; else cout<



