文章
105
粉丝
69
获赞
117
访问
56.7k
#include<bits/stdc++.h>
using namespace std;
int n, s, m;
bool st[110];
int main()
{
while(cin >> n >> s >> m, n ,s ,m)
{
memset(st, false, sizeof st);
int t = 0, cnt = 0;
while(1)
{
for(int i = s; i <= n; i ++)
{
if(!st[i]) cnt ++;
if(cnt % m == 0 && !st[i])
{
st[i] = true;
t ++;
if(t < n) cout << i << ",";
else cout << i << endl;
}
}
if(t >= n) break;
s = 1;
}
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发