跟 3# AC 代码编译出来的结果比了一下, 10000 以内的 n 输出结果 diff 全部一致, 但是我的代码是 WA。 为什么!!! #include<iostream> #include<deque> using std::deque; using std::cout; using std::cin; using std::endl; int main() { std::ios::sync_with_stdio(false); int T; cin >> T; for (int t=0; t<T; t++) { int n; cin >> n; deque<int> Q; for (int i=n; i>0; i--) { Q.push_front(i); int t = Q.back(); Q.pop_back(); Q.push_front(t); } for (deque<int>::iterator it=Q.begin(); it!=Q.end(); it++) { if (it != Q.begin()) cout << ' '; cout << *it; } cout << endl; } return 0; }
点赞 4

相关推荐

牛客网
牛客网在线编程
牛客网题解
牛客企业服务