UVA - 147 Dollars

ⅰ亾dé卋堺 提交于 2020-02-29 20:49:21

解题报告:

思路:和UVA - 674题目解法一样。这题要注意精度。

代码:

#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

const ll N = 3e4+10;
const ll dic[11] = {5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000};

ll dp[N];
double n;

void init(){
    dp[0] = 1;
    for(ll i=0; i<11; ++i){
        for(ll j=dic[i]; j<N; ++j){
            dp[j] += dp[j - dic[i]];
        }
    }
}

int main(){
    init();
    while(~scanf("%lf", &n)){
        ll nn = n*100+0.5;
        if(!nn)break;
        printf("%6.2f%17lld\n", n, dp[nn]);
    }
    return 0;
}

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!