题解
2026-09-29 16:37:06
发布于:浙江
0阅读
0回复
0点赞
此题有陷阱,n是无用变量
#include<bits/stdc++.h>
using namespace std;
int main(){
queue<int>q;
int k,n,p;
cin>>k>>n>>p;
for(int i=1;i<=k;i++){
q.push(i);
}
while(!q.empty()){
cout<<q.front()<<" ";
q.pop();
for(int i=1;i<=p;i++){
q.push(q.front());
q.pop();
}
}
return 0;
}
这里空空如也

有帮助,赞一个