링크 : https://www.acmicpc.net/problem/11866
#include <iostream>
#include <queue>
#include <string>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
queue<int> q;
int n = 0, k = 0;
cin >> n >> k;
for(int i = 1; i < n+1; i++){
q.push(i);
}
int index = 1;
int cnt = 0;
cout << "<";
while(cnt != n){
if(index % k == 0) {
cout << q.front();
q.pop();
cnt ++;
if(cnt != n) cout << ", ";
}
else {
q.push(q.front());
q.pop();
}
index ++;
}
cout << ">";
return 0;
}