我是小学生 • 11天前
using namespace std; typedef long long ll; set a; queue q; ll n,k,p,cnt=0;
ll b[1000000]= {0};
int main() {
cin>>n>>k>>p;
for(ll i=1; i<=k; i++) {
q.push(i);
}
while(!q.empty()) {
if(cnt%n==n-1) {
a.insert(q.front());
}
q.pop();
for(ll i=1; i<=p; i++) {
q.push(q.front());
q.pop();
}
cnt++;
}
set<ll>::iterator it=a.begin();
while(it!=a.end())
{
cout<<*it<<endl;
++it;
}
return 0;
}
评论:
请先登录,才能进行评论