4 solutions

  • 0
    @ 2025-7-14 16:11:32

    #include <bits/stdc++.h> using namespace std; bool a[105] = {0}; int main() { int n, m, f = 0, t = 0, s = 0; cin >> n >> m; while (f != n) { t++; if (t > n) t = 1;

    	if (!a[t])
    	s++;
    	if (s == m) {
    		cout << t << " ";
    		s = 0;
    		a[t] = 1;
    		f++;
    	}
    }
    return 0;
    

    }

    Information

    ID
    388
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    3
    Tags
    # Submissions
    67
    Accepted
    38
    Uploaded By