-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11866.cpp
More file actions
36 lines (33 loc) · 695 Bytes
/
11866.cpp
File metadata and controls
36 lines (33 loc) · 695 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>
#include <deque>
#include <algorithm>
#include <string>
#define io ios::sync_with_stdio(false); cin.tie(0);
using namespace std;
int main()
{
io;
int N,K;
cin>>N>>K;
deque<int> deq;
for(int i=1;i<=N;i++){
deq.push_back(i);
}
string s="<";
while(!deq.empty()){
if(deq.size()>K-1){
rotate(deq.begin(),deq.begin()+K-1,deq.end());
}
else{
for(int i=0;i<K-1;i++){
rotate(deq.begin(),deq.begin()+1,deq.end());
}
}
s+=to_string(deq.front())+", ";
deq.pop_front();
}
s.pop_back();
s.pop_back();
cout<<s<<'>';
return 0;
}