标签:das inline ++ stream 传送门 get read bsp cst
背包
——代码
#include <cstdio> #include <iostream> #define LL long long int v, n; LL f[10001]; inline int read() { int x = 0, f = 1; char ch = getchar(); for(; !isdigit(ch); ch = getchar()) if(ch == ‘-‘) f = -1; for(; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + ch - ‘0‘; return x * f; } int main() { int i, j, x; v = read(); n = read(); f[0] = 1; for(i = 1; i <= v; i++) { x = read(); for(j = x; j <= n; j++) f[j] += f[j - x]; } printf("%lld\n", f[n]); return 0; }
[luoguP1474] 货币系统 Money Systems(背包)
标签:das inline ++ stream 传送门 get read bsp cst
原文地址:http://www.cnblogs.com/zhenghaotian/p/7054424.html