用栈(stack)解题:
2025-08-25 12:44:48
发布于:浙江
0阅读
0回复
0点赞
根据栈的基本操作,得:
#include <bits/stdc++.h>
using namespace std;
int n;
stack <int> st;
int main(){
cin >> n;
while (cin >> n){
st.push(n);
}
while (st.size()){
cout << st.top() << " ";
st.pop();
}
return 0;
}
这里空空如也
有帮助,赞一个