Skip to content

Commit

Permalink
2024-02-21
Browse files Browse the repository at this point in the history
  • Loading branch information
miniron-v committed Feb 21, 2024
1 parent 773cbd2 commit 54c883d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
24 changes: 24 additions & 0 deletions miniron-v/DP/1699-제곱수의 ν•©.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <iostream>
#include <vector>

int main() {
int n;
std::cin >> n;

std::vector<int> 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];
}
1 change: 1 addition & 0 deletions miniron-v/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
---

0 comments on commit 54c883d

Please sign in to comment.