#include<bits/stdc++.h>
#define ll unsigned long long int
using namespace std;
ll coin(ll a[], ll n, ll tk)
{
ll i, j, t[tk+1];
t[0] = 1;
for(i=1;i<=tk;i++)
t[i] = 0;
for(i=0;i<n;i++)
{
for(j=a[i];j<=tk;j++)
{
t[j] = t[j] + t[j-a[i]];
}
}
return t[tk];
}
int main()
{
double n;
string s;
while(cin >> s && s != "0.00")
{
ll p = 0;
for(int i=0;i<s.size();i++)
{
if(s[i] == '.')
{
continue;
}
else
{
int t = s[i] - 48;
p = p*10 + t;
}
}
ll a[11];
a[0] = 5;
a[1] = 10;
a[2] = 20;
a[3] = 50;
a[4] = 1*100;
a[5] = 2*100;
a[6] = 5*100;
a[7] = 10*100;
a[8] = 20*100;
a[9] = 50*100;
a[10] = 100*100;
ll t = coin(a, 11, p);
cout << right << setw(6) << setfill(' ') << s;
cout << right << setw(17) << setfill(' ') << t << "\n";
}
return 0;
}
#define ll unsigned long long int
using namespace std;
ll coin(ll a[], ll n, ll tk)
{
ll i, j, t[tk+1];
t[0] = 1;
for(i=1;i<=tk;i++)
t[i] = 0;
for(i=0;i<n;i++)
{
for(j=a[i];j<=tk;j++)
{
t[j] = t[j] + t[j-a[i]];
}
}
return t[tk];
}
int main()
{
double n;
string s;
while(cin >> s && s != "0.00")
{
ll p = 0;
for(int i=0;i<s.size();i++)
{
if(s[i] == '.')
{
continue;
}
else
{
int t = s[i] - 48;
p = p*10 + t;
}
}
ll a[11];
a[0] = 5;
a[1] = 10;
a[2] = 20;
a[3] = 50;
a[4] = 1*100;
a[5] = 2*100;
a[6] = 5*100;
a[7] = 10*100;
a[8] = 20*100;
a[9] = 50*100;
a[10] = 100*100;
ll t = coin(a, 11, p);
cout << right << setw(6) << setfill(' ') << s;
cout << right << setw(17) << setfill(' ') << t << "\n";
}
return 0;
}
Comments
Post a Comment