题解 | #Zero-complexity Transposition#

Zero-complexity Transposition

http://www.nowcoder.com/practice/c54775799f634c72b447ef31eb36e975

/*
描述
You are given a sequence of integer numbers. Zero-complexity transposition of the sequence is the reverse of this sequence. Your task is to write a program that prints zero-complexity transposition of the given sequence.
输入描述:
For each case, the first line of the input file contains one integer n-length of the sequence (0 < n ≤ 10 000). The second line contains n integers numbers-a1, a2, …, an (-1 000 000 000 000 000 ≤ ai ≤ 1 000 000 000 000 000).
输出描述:
For each case, on the first line of the output file print the sequence in the reverse order.
*/

#include<iostream>
#include<stack>

using namespace std;


int main() {
    int n,tmp;
    stack<int> arr;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> tmp;
        arr.push(tmp);
    }
    while (!arr.empty())
    {
        cout << arr.top() << " ";
        arr.pop();
    }
    return 0;
}
全部评论

相关推荐

01-30 22:03
门头沟学院 Java
用微笑面对困难:我滴妈,【俩月】【实习】【主管】仨debuff吃满了,独立设计开发的项目写了绝大占比的运营板块,你独立开发,那维护、问题复盘、日志更新、bug、策划书全是自己整的? 不建议写那么大,可以从小出发更容易
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
正在热议
更多
# 春招至今,你的战绩如何? #
11330次浏览 95人参与
# 你的实习产出是真实的还是包装的? #
2012次浏览 42人参与
# 米连集团26产品管培生项目 #
6093次浏览 216人参与
# 军工所铁饭碗 vs 互联网高薪资,你会选谁 #
7683次浏览 43人参与
# 简历第一个项目做什么 #
31784次浏览 343人参与
# 重来一次,我还会选择这个专业吗 #
433633次浏览 3926人参与
# MiniMax求职进展汇总 #
24189次浏览 310人参与
# 当下环境,你会继续卷互联网,还是看其他行业机会 #
187252次浏览 1122人参与
# 牛客AI文生图 #
21456次浏览 238人参与
# 不考虑薪资和职业,你最想做什么工作呢? #
152502次浏览 888人参与
# 研究所笔面经互助 #
118982次浏览 577人参与
# 简历中的项目经历要怎么写? #
310447次浏览 4223人参与
# AI时代,哪些岗位最容易被淘汰 #
63959次浏览 832人参与
# 面试紧张时你会有什么表现? #
30526次浏览 188人参与
# 你今年的平均薪资是多少? #
213183次浏览 1039人参与
# 你怎么看待AI面试 #
180238次浏览 1261人参与
# 高学历就一定能找到好工作吗? #
64345次浏览 620人参与
# 你最满意的offer薪资是哪家公司? #
76597次浏览 374人参与
# 我的求职精神状态 #
448209次浏览 3129人参与
# 正在春招的你,也参与了去年秋招吗? #
363600次浏览 2638人参与
# 腾讯音乐求职进展汇总 #
160704次浏览 1112人参与
# 校招笔试 #
471424次浏览 2964人参与
牛客网
牛客网在线编程
牛客网题解
牛客企业服务