#include <iostream>
#include <queue>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int N, K; cin >> N>>K;
queue<int>q;
for (int i = 1; i <= N; i++) {
q.push(i);
}
cout << "<";
while (!q.empty()) {
int cnt = 1;
while (true) {
if (cnt == K) {
cout << q.front();
q.pop();
if (!q.empty()) cout << ", ";
break;
}
int temp = q.front();
q.pop();
q.push(temp);
cnt++;
}
}
cout << ">";
}
'Algorithm ๐ง๐ปโ๐ป > ๋ฐฑ์ค(BOJ)' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค,c++] 12015๋ฒ - ๊ฐ์ฅ ๊ธด ์ฆ๊ฐํ๋ ๋ถ๋ถ ์์ด2 (0) | 2021.11.02 |
---|---|
[๋ฐฑ์ค,c++] 1197๋ฒ - ์ต์ ์คํจ๋ ํธ๋ฆฌ (0) | 2021.11.02 |
[๋ฐฑ์ค,c++] 11931๋ฒ - ์ ์ ๋ ฌํ๊ธฐ4 (0) | 2021.11.02 |
[๋ฐฑ์ค,c++] 1182๋ฒ - ๋ถ๋ถ ์์ด์ ํฉ (0) | 2021.11.01 |
[๋ฐฑ์ค,c++] 1181๋ฒ - ๋จ์ด์ ๋ ฌ (0) | 2021.10.31 |
[๋ฐฑ์ค,c++] 11780๋ฒ - ํ๋ก์ด๋2 (0) | 2021.10.31 |
๋๊ธ