Saleh127

UVA 147

Nov 17th, 2020
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 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[]= {5,10,20,50,100,200,500,1000,2000,5000,10000};
  13.  
  14. dp[0]=1;
  15. for(ll i=0; i<11; i++)
  16. {
  17. for(ll j=coin[i]; j<=30000; j++)
  18. {
  19. dp[j]+=dp[j-coin[i]];
  20. }
  21. }
  22.  
  23. double n;
  24.  
  25. while(scanf("%lf",&n)==1)
  26. {
  27. if(n==0) return 0;
  28. ll x =int(round(n*100));
  29. printf("%6.2lf%17lld\n",n,dp[x]);
  30.  
  31. }
  32.  
  33. return 0;
  34. }
  35.  
  36. /*
  37. while(~scanf("%lf", &n)) {
  38. if(n - 0.00 < eps) break;
  39. ll x = (n * 100 +0.5);
  40. printf("%6.2f%17lld\n", x * 1.0 / 100, dp[x]);
  41.  
  42. }
  43. */
  44.  
  45.  
  46.  
Advertisement
Add Comment
Please, Sign In to add comment