Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdio.h>
- #include <cmath>
- using namespace std;
- long long m[11][30001];
- int a[11] = {5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000};
- int main()
- {
- for(int i=0; i<11; i++)
- m[i][0] = 1;
- for(int i=1; i<30001; i++)
- m[0][i] = 1;
- for(int i=1; i<11; i++)
- {
- for(int j=0; j<30001; j++)
- {
- if(j >= a[i])
- m[i][j] = m[i-1][j] + m[i][j-a[i]];
- else
- m[i][j] = m[i-1][j];
- }
- }
- float n;
- scanf("%f", &n);
- while(n != 0.00)
- {
- int k = (int) round(n * 100);
- printf("%6.2f%17lld\n", n, m[10][k]);
- scanf("%f", &n);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment