Advertisement
Guest User

Dollars

a guest
Jun 17th, 2015
721
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.06 KB | None | 0 0
  1.     #include<iostream>
  2.     #include<list>
  3.     #include<string>
  4.     #include<cstring>
  5.     #include<sstream>
  6.     #include<cctype>
  7.     #include<string.h>
  8.     #include<algorithm>
  9.     #include<cmath>
  10.     #include<stack>
  11.     #include<fstream>
  12.     #include<cstdlib>
  13.     #include<vector>
  14.     #include<map>
  15.     #include<set>
  16.     #include<utility>
  17.     #include<iomanip>
  18.     #include<queue>
  19.  
  20.     using namespace std;
  21.  
  22.     #define INF (1<<29)
  23.     #define SET(a) memset(a,-1,sizeof(a))
  24.     #define ALL(a) a.begin(),a.end()
  25.     #define CLR(a) memset(a,0,sizeof(a))
  26.     #define FILL(a,v) memset(a,v,sizeof(a))
  27.     #define PB push_back
  28.     #define FOR(i,n) for(int i = 0;i<n;i++)
  29.     #define PI acos(-1.0)
  30.     #define EPS 1e-9
  31.     #define MP(a,b) make_pair(a,b)
  32.     #define min3(a,b,c) min(a,min(b,c))
  33.     #define max3(a,b,c) max(a,max(b,c))
  34.     #define READ freopen("input.txt", "r", stdin)
  35.     #define WRITE freopen("output.txt", "w", stdout)
  36.     #define LL long long
  37.     #define MX 100010
  38.     #define MOD 1000000007
  39.     int s[] = {10000,5000,2000,1000,500,200,100,50,20,10,5};
  40.     LL count(LL n){
  41.         LL table[n+1];
  42.         for(int i =0;i<n+1;i++)table[i] =0;
  43.         table[0] = 1;
  44.         for(int i =0;i<11;i++){
  45.                 for(int j = s[i];j<n+1;j++){
  46.                     table[j]+=table[j-s[i]];
  47.                 }
  48.             }
  49.             return table[n];
  50.     }
  51.     int main(){
  52.         string s;
  53.         while(cin>>s){
  54.             int i = 0, n = 0, d = 0;
  55.             for(; s[i] != '.'; i++) n = 10*n + s[i] - '0';
  56.             for(++i; i < s.length(); i++) d = 10*d + s[i] - '0';
  57.             if(100*n+d>0){
  58.                 if(n<100) cout << " ";
  59.                 if(n<10) cout << " ";
  60.                 cout << n << ".";
  61.                 if(d < 10) cout << "0";
  62.                 cout << d;
  63.                 int digs = 17;
  64.                 LL ans = count(100*n+d);
  65.                 LL x = ans;
  66.                 while(x>0) x /= 10, digs--;
  67.                 for(int t = 0; t < digs; t++) cout << " ";
  68.                 cout << ans << "\n";
  69.         }
  70.     }
  71.  
  72.         return 0;
  73.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement