这道题用栈做不很轻松吗
2026-08-08 21:09:57
发布于:云南
0阅读
0回复
0点赞
直接上代码:
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
stack<int>st;
for(int i = 1;i<=n;i++){
int a;
cin>>a;
st.push(a);
}
while(!st.empty()){
cout<<st.top()<<' ';
st.pop();
}
return 0;
}
这里空空如也








有帮助,赞一个