llllmz

导航

KY109 Zero-complexity TranspositionC++

h

很简单的题目,不管是用数组还是用栈都非常简单。

#include<iostream>
#include<stack>
using namespace std;
int main(){
    int n;
    while(cin >> n){
        stack<long> s;
        while(n!=0){
            int tem;
            cin >> tem;
            s.push(tem);
            n--;
        }
        while(!s.empty()){
            int x=s.top();
            cout << x <<' ';
            s.pop();
        }
    }
    return 0;
}

结果:

posted on 2024-01-18 14:40  神奇的萝卜丝  阅读(16)  评论(0)    收藏  举报