AcWing 1023. 买书
原题链接
简单
作者:
cylove
,
2024-04-19 08:34:15
,
所有人可见
,
阅读 3
完全背包
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast,no-stack-protector")
#include <bits/stdc++.h>
const int N = 1010 ;
int f[N];
int a[5] = {0 , 10 , 20 , 50 , 100} ;
int main()
{
std::ios::sync_with_stdio(false) ;
std::cin.tie(nullptr) ;
#ifdef LOCAL
freopen("D:\\Codes\\in.txt" , "r" , stdin) ;
freopen("D:\\Codes\\out.txt" , "w" , stdout) ;
#endif
int n ;
std::cin >> n ;
f[0] = 1 ;
for(int i = 1 ; i <= 4 ; ++ i)
for(int j = a[i] ; j <= n ; ++ j)
f[j] += f[j - a[i]] ;
std::cout << f[n] << '\n' ;
return 0 ;
}