diff --git a/YIM2UL2ET/README.md b/YIM2UL2ET/README.md index 71c5f9a..3927de4 100644 --- a/YIM2UL2ET/README.md +++ b/YIM2UL2ET/README.md @@ -6,6 +6,9 @@ | 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) | -| 5차시 | 2024.02.21 | 정렬 | [BOJ 1599](https://www.acmicpc.net/problem/1599) | [BOJ 1599 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/21) | +| 5차시 | 2024.02.24 | 큐 | [BOJ 1158](https://www.acmicpc.net/problem/1158) | [BOJ 1158 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/16) | +| 6차시 | 2024.02.27 | 정렬 | [BOJ 1599](https://www.acmicpc.net/problem/1599) | [BOJ 1599 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/21) | +| 7차시 | 2024.03.01 | 재귀 | [BOJ 2705](https://www.acmicpc.net/problem/2705) | [BOJ 2705 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/23) | +| 8차시 | 2024.03.04 | 재귀 | [BOJ 10994](https://www.acmicpc.net/problem/10994) | [BOJ 10994 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/27) | +| 9차시 | 2024.03.07 | 임의 정밀도 / 큰 수 연산 && 재귀 | [BOJ 1914](https://www.acmicpc.net/problem/1914) | [BOJ 1914 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/29) | --- diff --git "a/YIM2UL2ET/\354\236\204\354\235\230 \354\240\225\353\260\200\353\217\204, \355\201\260 \354\210\230 \354\227\260\354\202\260/9\354\260\250\354\213\234 - BOJ 1914.cpp" "b/YIM2UL2ET/\354\236\204\354\235\230 \354\240\225\353\260\200\353\217\204, \355\201\260 \354\210\230 \354\227\260\354\202\260/9\354\260\250\354\213\234 - BOJ 1914.cpp" new file mode 100644 index 0000000..e870bff --- /dev/null +++ "b/YIM2UL2ET/\354\236\204\354\235\230 \354\240\225\353\260\200\353\217\204, \355\201\260 \354\210\230 \354\227\260\354\202\260/9\354\260\250\354\213\234 - BOJ 1914.cpp" @@ -0,0 +1,37 @@ +#include + +std::string FindValue(int n) +{ + std::string result = "1"; + for (int i = 0; i < n; i++) { + for (int j = 0; j < result.size(); j++) { + result[j] = (result[j] - '0') * 2 + '0'; + if (result[j] > '9') { + result[j] -= 10; + if (j == 0) result.insert(result.begin(), '1'), j++; + else result[j-1]++; + } + } + } + result[result.size()-1]--; + return result; +} + +void Hanoi(int level, int start, int between, int end) +{ + if (level == 1) std::cout << start << " " << end << "\n"; + else { + Hanoi(level-1, start, end, between); + std::cout << start << " " << end << "\n"; + Hanoi(level-1, between, start, end); + } + return; +} + +int main(void) { + int n; + std::cin >> n; + std::cout << FindValue(n) << "\n"; + if (!(n > 20)) Hanoi(n, 1, 2, 3); + return 0; +} \ No newline at end of file diff --git "a/YIM2UL2ET/\354\236\254\352\267\200/7\354\260\250\354\213\234 - BOJ 2705.cpp" "b/YIM2UL2ET/\354\236\254\352\267\200/7\354\260\250\354\213\234 - BOJ 2705.cpp" new file mode 100644 index 0000000..ec0d7bb --- /dev/null +++ "b/YIM2UL2ET/\354\236\254\352\267\200/7\354\260\250\354\213\234 - BOJ 2705.cpp" @@ -0,0 +1,23 @@ +#include + +int ary[1000] = {0}; + +int solve(int n) +{ + if (ary[n-1] != 0) return ary[n-1]; + for (int i = 0; n-i*2 > 1;) ary[n-1] += solve(++i); + return ++ary[n-1]; +} + +int main(void) +{ + int n, input; + ary[0] = 1; + + std::cin >> n; + for (int i = 0; i < n; i++) { + std::cin >> input; + std::cout << solve(input) << std::endl; + } + return 0; +} \ No newline at end of file diff --git "a/YIM2UL2ET/\354\236\254\352\267\200/8\354\260\250\354\213\234 - BOJ 10994.cpp" "b/YIM2UL2ET/\354\236\254\352\267\200/8\354\260\250\354\213\234 - BOJ 10994.cpp" new file mode 100644 index 0000000..8728e2e --- /dev/null +++ "b/YIM2UL2ET/\354\236\254\352\267\200/8\354\260\250\354\213\234 - BOJ 10994.cpp" @@ -0,0 +1,42 @@ +#include + +void cover1(int n, int level) +{ + for (int i = 0; i < level; i++) std::cout << "* "; + for (int i = 0; i < 4*(n-level)-3; i++) std::cout << "*"; + for (int i = 0; i < level; i++) std::cout << " *"; + std::cout << "\n"; +} + +void cover2(int n, int level) +{ + for (int i = 0; i < level; i++) std::cout << "* "; + std::cout << "*"; + for (int i = 0; i < 4*(n-level)-5; i++) std::cout << " "; + std::cout << "*"; + for (int i = 0; i < level; i++) std::cout << " *"; + std::cout << "\n"; +} + +void star(int n, int level) +{ + if (n == level+1) { + for (int i = 0; i < n*2-2; i++) std::cout << "* "; + std::cout << "*\n"; + } + else { + cover1(n, level); + cover2(n, level); + star(n, level+1); + cover2(n, level); + cover1(n, level); + } +} + +int main(void) +{ + int n; + std::cin >> n; + star(n, 0); + return 0; +} \ No newline at end of file