一本通 1293:买书
买书
货币系统的简化版,注意特判0。
#include <iostream>
#include <cstdio>
using namespace std;
//Mystery_Sky
//
#define ll long long
#define M 10000
int v, m;
ll c[M], f[M];
int main() {
scanf("%d", &v);
c[1] = 10, c[2] = 20, c[3] = 50, c[4] = 100;
f[0] = 1;
if(v == 0) {
printf("0\n");
return 0;
}
for(int i = 1; i <= 4; i++)
for(int j = c[i]; j <= v; j++)
f[j] += f[j-c[i]];
printf("%lld\n", f[v]);
return 0;
}
唯愿,青春不辜负梦想,未来星辰闪耀