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. Redis Jedsi使用方法

    JedisPoolConfig:用于配置Jedis连接池的配置 JedisPool:使用连接池获取Jedis连接 Jedis:实际与Redis进行一系列的操作 代码示例: public void de ...

  2. bzoj 1604: [Usaco2008 Open]Cow Neighborhoods 奶牛的邻居【切比雪夫距离+并查集+multiset】

    参考:http://hzwer.com/4361.html 坐标开long long,inf开大点 先曼哈顿转切比雪夫(x+y,x-y),距离就变成了max(x',y'): 先按x排序,维护两个指针, ...

  3. (DP)51NOD 1085 背包问题

    在N件物品取出若干件放在容量为W的背包里,每件物品的体积为W1,W2……Wn(Wi为整数),与之相对应的价值为P1,P2……Pn(Pi为整数).求背包能够容纳的最大价值. Input 第1行,2个整数 ...

  4. JAVA POI的使用

    最近开发遇到了要通过Java处理Excel文件的场景,于是乎在网上了解了一番,最后自己做了个demo,已上传gitee:https://gitee.com/github-26930945/JavaCo ...

  5. java8的LocalDateTime与Date互相转换

    LocalDateTime转Date Instant instant = localDateTime.atZone(ZoneId.systemDefault()).toInstant(); Date ...

  6. ASP.NET 知识点总结(六)

    1.传入某个属性的set方法的隐含参数的名称是什么?value,它的类型和属性所声名的类型相同. 2.如何在C#中实现继承? 在类名后加上一个冒号,再加上基类的名称.3.C#支持多重继承么? 类之间不 ...

  7. *RelativeLayout的布局参数含义表,如android:layout_alignParentTop等

    RelativeLayout 参数规则 一个控件的位置由横,纵两个方向上的距离决定 控件默认的位置在左上角. 单独使用以下属性都只是改变一个方向的相对位置. 如:只使用了android:layout_ ...

  8. 有符号char转无符号short

    ; cout<<(int)ch<<endl; //-1 unsigned short d = ch; short dd = ch; cout<<d<<e ...

  9. Spring.Net学习笔记(二)-数据访问器

    Spring对ADO.NET也提供了支持,依赖与程序集Spring.Data.dll IDbProvider IDbProvider定义了数据访问提供器的基础,配置如下 <?xml versio ...

  10. log4j2异步日志解读(二)AsyncLogger

    前文已经讲了log4j2的AsyncAppender的实现[log4j2异步日志解读(一)AsyncAppender],今天我们看看AsyncLogger的实现. 看了这个图,应该很清楚AsyncLo ...