Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- constexpr int coins[] = {1, 2, 5, 10, 20, 50, 100, 200};
- int dp[201][8];
- signed main() {
- ios::sync_with_stdio(0);
- cin.tie(0); cout.tie(0);
- dp[0][0] = 1;
- for (int i = 0; i <= 200; i++) {
- for (int j = 0; j < 8; j++) {
- if (j < 7) dp[i][j + 1] += dp[i][j];
- if (i + coins[j] < 201) dp[i + coins[j]][j] += dp[i][j];
- }
- }
- cout << dp[200][7];
- }
Advertisement
Add Comment
Please, Sign In to add comment