#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//dp[i],最多100枚硬币
const int a[5] = {1, 5, 10, 25, 50};
int main() {
int n;
while (cin >> n) {
ll dp[255][101]; // dp[j][k]:用k个硬币组成j值的个数
dp[0][0] = 1;
for (int i = 0; i < 5; i++)
for (int k = 1; k <= 100; k++) // k个硬币
for (int j = a[i]; j <= n; j++) dp[j][k] += dp[j - a[i]][k - 1];
ll ans = 0;
for (int i = 0; i <= 100; i++) ans += dp[n][i];
cout << ans << endl;
}
return 0;
} 母函数/完全背包 待了解

京公网安备 11010502036488号