Dollars

Time Limit: 3000ms
Memory Limit: 131072KB

This problem will be judged on UVA. Original ID: 147
64-bit integer IO format: %lld      Java class name: Main

 

New Zealand currency consists of $100, $50, $20, $10, and $5 notes and $2, $1, 50c, 20c, 10c and 5c coins. Write a program that will determine, for any given amount, in how many ways that amount may be made up. Changing the order of listing does not increase the count. Thus 20c may be made up in 4 ways: 1  20c, 2  10c, 10c+2  5c, and 4  5c.

Input

Input will consist of a series of real numbers no greater than $300.00 each on a separate line. Each amount will be valid, that is will be a multiple of 5c. The file will be terminated by a line containing zero (0.00).

Output

Output will consist of a line for each of the amounts in the input, each line consisting of the amount of money (with two decimal places and right justified in a field of width 6), followed by the number of ways in which that amount may be made up, right justified in a field of width 17.

Sample input

0.20
2.00
0.00

Sample output

  0.20                4
2.00 293 解题:几个坑。一是要用long long ,而是要输入0 终止程序
 #include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <queue>
#include <cstdlib>
#include <string>
#include <set>
#include <stack>
#define LL long long
#define pii pair<int,int>
#define INF 0x3f3f3f3f
using namespace std;
int c[] = {,,,,,,,,,,};
LL dp[];
int main() {
int val = ;
double ans;
memset(dp,,sizeof(dp));
dp[] = ;
for(int i = ; i < ; i++){
for(int j = c[i]; j <= val; j++){
dp[j] += dp[j-c[i]];
}
}
while(~scanf("%lf",&ans) && ans != 0.00 ){
printf("%6.2f%17lld\n",ans,dp[int(ans*+0.5)]);
}
return ;
}

BNUOJ 17286 Dollars的更多相关文章

  1. uva 147 Dollars

    http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p ...

  2. BNUOJ 52325 Increasing or Decreasing 数位dp

    传送门:BNUOJ 52325 Increasing or Decreasing题意:求[l,r]非递增和非递减序列的个数思路:数位dp,dp[pos][pre][status] pos:处理到第几位 ...

  3. bnuoj 24251 Counting Pair

    一道简单的规律题,画出二维表将数字分别相加可以发现很明显的对称性 题目链接:http://www.bnuoj.com/v3/problem_show.php?pid=24251 #include< ...

  4. CF# Educational Codeforces Round 3 D. Gadgets for dollars and pounds

    D. Gadgets for dollars and pounds time limit per test 2 seconds memory limit per test 256 megabytes ...

  5. bnuoj 44359 快来买肉松饼

    http://www.bnuoj.com/contest/problem_show.php?pid=44359 快来买肉松饼 Time Limit: 5000 ms     Case Time Lim ...

  6. BNUOJ 1006 Primary Arithmetic

    Primary Arithmetic 来源:BNUOJ 1006http://www.bnuoj.com/v3/problem_show.php?pid=1006 当你在小学学习算数的时候,老师会教你 ...

  7. bnuoj 34985 Elegant String DP+矩阵快速幂

    题目链接:http://acm.bnu.edu.cn/bnuoj/problem_show.php?pid=34985 We define a kind of strings as elegant s ...

  8. Codeforces Educational Codeforces Round 3 D. Gadgets for dollars and pounds 二分,贪心

    D. Gadgets for dollars and pounds 题目连接: http://www.codeforces.com/contest/609/problem/C Description ...

  9. bnuoj 25659 A Famous City (单调栈)

    http://www.bnuoj.com/bnuoj/problem_show.php?pid=25659 #include <iostream> #include <stdio.h ...

随机推荐

  1. [Swift通天遁地]一、超级工具-(19)制作六种别具风格的动作表单

    ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...

  2. 慕课网2-5 编程练习:通过jQuery通配符选择器进行文字变色

    2-5 编程练习 请请使用*选择器将div标签中的字体颜色变成红色 效果图: 任务 (1)使用通配符选择器 (2)使用jQuery的.css()方法设置样式,语法css('属性 '属性值') 参考代码 ...

  3. TestNG设置用例循环执行

    曾经做过一需求,需要单个集成测试用例循环执行N次,或许你会说for循环就可以了,这当然是可以的.那有没有逼格更高点的方法,当然也是有的.下面我们就说下使用TestNG注解功能实现用例的循环执行. 1. ...

  4. eccharts-gl 3D立体柱状图

    echarts-gl继承于echarts echarts-gl官方实例https://echarts.baidu.com/examples/index.html#chart-type-globe 代码 ...

  5. PHP的包依赖管理工具Composer简介

    composer是一个基于项目的依赖管理器,负责将php项目的所依赖的包和库安装在项目的目录中,默认不会不会安装任何数据到全局.他用于取代之前pear工具 1 安装Composer curl -sS  ...

  6. Android 性能优化(17)UI优化:Keeping Your App Responsive 拒绝ANR

    Keeping Your App Responsive In this document What Triggers ANR? How to Avoid ANRs Reinforcing Respon ...

  7. 在Azure Ubunt Server 14.04虚机中使用Deep-Visualization-Toolbox

      参考网站 a)   https://zhuanlan.zhihu.com/p/24833574?utm_source=tuicool&utm_medium=referral b)   ht ...

  8. 6.12mysql自己的数据库的作用

  9. php函数的声明与使用

    function 函数名(){ 函数体 } 一个函数是由3部分组成:声明(function 关键字).函数名(用来找到函数体的).函数体(封装的代码) 2.函数的优越性 代码重用性强.维护方便.提高开 ...

  10. 由ibatis向mybatis的转变

    我将项目引用的ibatis换成mybatis 过程中遇到一个问题:org.apache.ibatis.datasource.DataSourceException: Unknown DataSourc ...