#include<iostream>
#include<list>
#include<stack>
using namespace std;
int main() {
list<int> a;
stack<int> b;
int n,j;
cin>>n;
for(int k=0; k<n; k++) {
int c;
cin>>c;
a.push_back(c);
}
cin>>j;
int y=a.size()%j;
int x=a.size();
for(int k=0; k<(x-y)/j; k++) {
for(int k=0; k<j; k++) {
b.push(a.front());
a.pop_front();
}
for(int k=0; k<j; k++) {
cout<<b.top()<<" ";
b.pop();
}
}
if(y!=0) {
for(auto n:a) {
cout<<n<<" ";
}
}
return 0;
}
全部回复 共 0 条
还没有人回复。往下写第一条。
发表回复
登录后即可回复本帖,与出题人和同学一起讨论。
登录