fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n, k;
  6. cin >> n >> k;
  7.  
  8. int to_kill = 0;
  9.  
  10. for (int i = 0; i < n; i++) {
  11. to_kill += k;
  12.  
  13. if (to_kill > n) {
  14. to_kill = to_kill - n;
  15. }
  16. cout << to_kill << "\n";
  17. }
  18.  
  19. cout << to_kill;
  20. return 0;
  21. }
Success #stdin #stdout 0.01s 5284KB
stdin
10 3
stdout
3
6
9
2
5
8
1
4
7
10
10