题解:B4295 [蓝桥杯青少年组国赛 2022] 报数游戏
Solution
模拟
为了方便,将编号设为
Code
#include<bits/stdc++.h>
using namespace std;
const int X = 105;
int x, y, k, tp = -1;
bool flg[2 * X];
inline int get(int aa){
return aa % (x + y);
}
int main(){
ios::sync_with_stdio(false);
cin.tie();
cin >> x >> y >> k;
for(int p = 1; p <= y; p++){
for(int q = 1; q <= k; q++){
tp++;
while(flg[get(tp)]) tp++;
}
flg[get(tp)] = 1;
}
for(int i = 0; i < x + y; i++) if(!flg[i]) cout << i + 1 << ' ';
return 0;
}