Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int coin[12] = {0, 1, 2, 4, 10, 20, 40, 100, 200, 400, 1000, 2000}; //Mã hóa (chia số tiền cho 5)
- long long dp[6005];
- int main(){
- //freopen("in.txt", "r", stdin);
- //freopen("B-Dollars.inp", "r", stdin);
- //freopen("B-Dollars.out", "w", stdout);
- ios_base::sync_with_stdio(false);
- cin.tie(NULL); cout.tie(NULL);
- dp[0] = 1;
- for(int i = 1; i <= 11; i++)
- for(int j = coin[i]; j <= 6000; j++)
- dp[j] += dp[j-coin[i]];
- double n;
- while(cin >> n) {
- if(n == 0.00) break;
- int m = int(n * 20);
- cout << setiosflags(ios::right) << setw(6) << setprecision(2) << fixed << n;
- cout << setiosflags(ios::right) << setw(17) << dp[m] << '\n';
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment