用栈(stack)解题:
2025-08-25 12:44:48
发布于:浙江
1阅读
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;
}
全部评论 1

2天前 来自 江苏
0















有帮助,赞一个