神秘大礼包
2023-08-07 10:28:02
发布于:浙江
#include<bits/stdc++.h>
using namespace std;
struct student{string name,city;}s;
long long n,m,z;
queue<student> q;
int main(){
freopen("GiftPack.in","r",stdin);
freopen("GiftPack.out","w",stdout);
cin >> n >> m;
for(int i = 1;i <= n;i++){
cin >> s.name >> s.city;
q.push(s);
}
for(int i = 1;i <= m;i++){
cin >> z;
z %= n;
if(z == 0) z = n;
for(int i = 1;i < z;i++){
q.push(q.front());
q.pop();
}
cout << q.front().name << " " << q.front().city << endl;
q.pop();
n--;
}
fclose(stdin);
fclose(stdout);
return 0;
}
这里空空如也
有帮助,赞一个