Advertisement
Saleh127

UVA 674

Nov 17th, 2020
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  5. ll dp[30005];
  6. int main()
  7. {
  8. ios_base::sync_with_stdio(0);
  9. cin.tie(0);
  10. cout.tie(0);
  11.  
  12. ll coin[]= {1, 5, 10, 25, 50};
  13.  
  14. dp[0]=1;
  15. for(ll i=0; i<5; i++)
  16. {
  17. for(ll j=coin[i]; j<=30000; j++)
  18. {
  19. dp[j]+=dp[j-coin[i]];
  20. }
  21. }
  22. ll n;
  23.  
  24. while(scanf("%lld",&n)==1)
  25. {
  26. if(n==0) cout<<0<<endl;
  27. else cout<<dp[n]<<endl;
  28.  
  29. }
  30.  
  31. return 0;
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement