买书
作者:互联网
https://www.acwing.com/problem/content/280/
\(完全背包变式\)
#include <bits/stdc++.h>
using namespace std;
#define IO ios::sync_with_stdio(false);cin.tie(0); cout.tie(0);
inline int lowbit(int x) { return x & (-x); }
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PII pair<int, int>
#define VIT vector<int>
#define x first
#define y second
#define inf 0x3f3f3f3f
const int N = 1010;
int f[N];
int a[] = {0, 10, 20, 50, 100};
int main() {
IO;
int n;
cin >> n;
f[0] = 1;
for (int i = 1; i <= 4; ++i)
for (int j = 0; j <= n; ++j)
if (j >= a[i]) f[j] += f[j - a[i]];
cout << f[n] << '\n';
return 0;
}
标签:,cout,int,long,IO,define,变式 来源: https://www.cnblogs.com/phr2000/p/14650521.html