Files
python/TangDou/AcWing/BeiBao/1023_1.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

20 lines
467 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int v[5] = {0, 10, 20, 50, 100};
int f[5][N];
int main() {
int m;
cin >> m;
// 前0种物品,体积是0的情况下只有一种方案
f[0][0] = 1;
for (int i = 1; i <= 4; i++)
for (int j = 0; j <= m; j++) {
f[i][j] = f[i - 1][j];
if (v[i] <= j) f[i][j] += f[i][j - v[i]];
}
printf("%d\n", f[4][m]);
return 0;
}