Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int n,b;
- cin>>n>>b;
- vector<int>v(n);
- for(int i=0;i<n;i++)
- {
- v[i]=i+1;
- }
- int k=0;
- while(!v.empty())
- {
- int p=(k+b-1)%v.size();
- cout<<v[p]<<" ";
- v.erase(v.begin()+p);
- k=p;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement