From 7ae593849559460049978e6c604fa9d7f61e588d Mon Sep 17 00:00:00 2001 From: miniron_v <61517039+miniron-v@users.noreply.github.com> Date: Mon, 19 Feb 2024 02:15:39 +0900 Subject: [PATCH 1/2] 2024-02-19 --- miniron-v/README.md | 7 ++-- .../1081-\355\225\251.cpp" | 36 +++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 "miniron-v/\354\210\230\355\225\231/1081-\355\225\251.cpp" diff --git a/miniron-v/README.md b/miniron-v/README.md index eac5d20..f8ea8e1 100644 --- a/miniron-v/README.md +++ b/miniron-v/README.md @@ -14,6 +14,9 @@ | 10차시 | 2024.01.28 | 그래프 | [토마토](https://www.acmicpc.net/problem/7569) | [#38](https://github.com/AlgoLeadMe/AlgoLeadMe-5/pull/38) | | 번외 - 10 | 2024.01.30 | 그래프 | [하이퍼 토마토](https://www.acmicpc.net/problem/17114) | [#42](https://github.com/AlgoLeadMe/AlgoLeadMe-5/pull/42) | | 11차시 | 2024.01.31 | 브루트포스 | [감소하는 수](https://www.acmicpc.net/problem/1038) | [#43](https://github.com/AlgoLeadMe/AlgoLeadMe-5/pull/43) | -| 12차시 | 2024.01.31 | DP | [점프 점프](https://www.acmicpc.net/problem/11060) | [#48](https://github.com/AlgoLeadMe/AlgoLeadMe-5/pull/48) | -| 13차시 | 2024.01.31 | DP | [퇴사 2](https://www.acmicpc.net/problem/15486) | [#50](https://github.com/AlgoLeadMe/AlgoLeadMe-5/pull/50) | +| 12차시 | 2024.02.03 | DP | [점프 점프](https://www.acmicpc.net/problem/11060) | [#48](https://github.com/AlgoLeadMe/AlgoLeadMe-5/pull/48) | +| 13차시 | 2024.02.06 | DP | [퇴사 2](https://www.acmicpc.net/problem/15486) | [#50](https://github.com/AlgoLeadMe/AlgoLeadMe-5/pull/50) | +| 14차시 | 2024.02.11 | 그래프, DP | [ACM Craft](https://www.acmicpc.net/problem/1005) | [#53](https://github.com/AlgoLeadMe/AlgoLeadMe-5/pull/53) | +| 15차시 | 2024.02.15 | DP, 큰 수 연산 | [타일링](https://www.acmicpc.net/problem/1793) | [#56](https://github.com/AlgoLeadMe/AlgoLeadMe-5/pull/56) | +| 16차시 | 2024.02.18 | 수학 | [합](https://www.acmicpc.net/problem/1081) | [#61](https://github.com/AlgoLeadMe/AlgoLeadMe-5/pull/61) | --- diff --git "a/miniron-v/\354\210\230\355\225\231/1081-\355\225\251.cpp" "b/miniron-v/\354\210\230\355\225\231/1081-\355\225\251.cpp" new file mode 100644 index 0000000..76daf6a --- /dev/null +++ "b/miniron-v/\354\210\230\355\225\231/1081-\355\225\251.cpp" @@ -0,0 +1,36 @@ +#include + +long long gaussSum(long long k) { + if (k % 2 == 0) { + return (k / 2) * (k + 1); + } + + return ((k + 1) / 2) * k; +} + +long long getSumOfPlace(long long n) { + if (n < 1) { + return 0; + } + + long long answer = gaussSum(n); + + long long d = 10; + while ((n / d) > 0) { + long long q = n / d; + long long r = n % d; + + answer -= 9 * (gaussSum(q - 1) * d + q * (r + 1)); + + d *= 10; + } + + return answer; +} + +int main() { + long long l, u; + std::cin >> l >> u; + + std::cout << getSumOfPlace(u) - getSumOfPlace(l - 1); +} \ No newline at end of file From 54c883d94d90b012a3623c7d013a96f98fa0a6e7 Mon Sep 17 00:00:00 2001 From: miniron_v <61517039+miniron-v@users.noreply.github.com> Date: Thu, 22 Feb 2024 03:39:04 +0900 Subject: [PATCH 2/2] 2024-02-21 --- ...\354\210\230\354\235\230 \355\225\251.cpp" | 24 +++++++++++++++++++ miniron-v/README.md | 1 + 2 files changed, 25 insertions(+) create mode 100644 "miniron-v/DP/1699-\354\240\234\352\263\261\354\210\230\354\235\230 \355\225\251.cpp" diff --git "a/miniron-v/DP/1699-\354\240\234\352\263\261\354\210\230\354\235\230 \355\225\251.cpp" "b/miniron-v/DP/1699-\354\240\234\352\263\261\354\210\230\354\235\230 \355\225\251.cpp" new file mode 100644 index 0000000..1461acc --- /dev/null +++ "b/miniron-v/DP/1699-\354\240\234\352\263\261\354\210\230\354\235\230 \355\225\251.cpp" @@ -0,0 +1,24 @@ +#include +#include + +int main() { + int n; + std::cin >> n; + + std::vector dp(n + 1, 0); + dp[1] = 1; + + for (int i = 2; i <= n; ++i) { + int min_index = i - 1; + + for (int j = 2; j * j <= i; ++j) { + if (dp[i - (j * j)] < dp[min_index]) { + min_index = i - (j * j); + } + } + + dp[i] = dp[min_index] + 1; + } + + std::cout << dp[n]; +} \ No newline at end of file diff --git a/miniron-v/README.md b/miniron-v/README.md index f8ea8e1..d2bb009 100644 --- a/miniron-v/README.md +++ b/miniron-v/README.md @@ -19,4 +19,5 @@ | 14차시 | 2024.02.11 | 그래프, DP | [ACM Craft](https://www.acmicpc.net/problem/1005) | [#53](https://github.com/AlgoLeadMe/AlgoLeadMe-5/pull/53) | | 15차시 | 2024.02.15 | DP, 큰 수 연산 | [타일링](https://www.acmicpc.net/problem/1793) | [#56](https://github.com/AlgoLeadMe/AlgoLeadMe-5/pull/56) | | 16차시 | 2024.02.18 | 수학 | [합](https://www.acmicpc.net/problem/1081) | [#61](https://github.com/AlgoLeadMe/AlgoLeadMe-5/pull/61) | +| 17차시 | 2024.02.21 | DP | [제곱수의 합](https://www.acmicpc.net/problem/1699) | [#64](https://github.com/AlgoLeadMe/AlgoLeadMe-5/pull/64) | ---