Skip to content

Commit

Permalink
5차시 업로드
Browse files Browse the repository at this point in the history
  • Loading branch information
YIM2UL2ET committed Feb 24, 2024
1 parent 9570c47 commit 92a10e8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions YIM2UL2ET/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
| 2차시 | 2024.02.15 | 그리디 | [BOJ 1263](https://www.acmicpc.net/problem/1263) | [BOJ 1449 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/7) |
| 3차시 | 2024.02.18 | 스택 | [BOJ 2504](https://www.acmicpc.net/problem/2504) | [BOJ 2504 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/9) |
| 4차시 | 2024.02.21 || [BOJ 1021](https://www.acmicpc.net/problem/1021) | [BOJ 1021 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/12) |
| 5차시 | 2024.02.21 || [BOJ 1158](https://www.acmicpc.net/problem/1158) | [BOJ 1158 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/16) |
---
24 changes: 24 additions & 0 deletions YIM2UL2ET/큐/5차시 - BOJ 1158.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <iostream>
#include <vector>

int main(void)
{
int size, k, idx = 0;
std::vector <int> v;

std::cin >> size >> k;
for (int i = 0; i < size;) v.push_back(++i);

std::cout << "<";
while(true) {
idx = (idx + k - 1) % size--;
std::cout << v[idx];
v.erase(v.begin() + idx);

if (size > 0) std::cout << ", ";
else break;
}
std::cout << ">";

return 0;
}

0 comments on commit 92a10e8

Please sign in to comment.