题解 | #Transposition#
Zero-complexity Transposition
https://www.nowcoder.com/practice/c54775799f634c72b447ef31eb36e975
#借用栈的思想,但要注意题目要求用long long类型,不过这道题用int也能对
#include "stdio.h"
#include "stack"
usingnamespacestd;
intmain(){
intn;longlongtemp;
stack<longlong> myStack;
while (scanf("%d",&n)!=EOF){
for (inti = 0; i < n; ++i) {
scanf("%lld",&temp);
myStack.push(temp);
}
while (!myStack.empty()){
printf("%lld ",myStack.top());
myStack.pop();
}
}
}