uva147:

题意:给你几种钱币,在给你一个钱的数目,问有多少种用这些钱来组成这个数目。

题解:完全背包,不过此时要把钱的数目*100,因为是小数,背包的容量都是整数,然后dp,求出每个容量的数目即可

 #include<cstring>
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<iomanip>
using namespace std;
int we[];
long long dp[];
int main(){
we[]=;we[]=;we[]=;we[]=;we[]=;
we[]=;we[]=;we[]=;we[]=;we[]=;we[]=;
float ss;
memset(dp,,sizeof(dp));
dp[]=;
for(int i=;i<=;i++){
for(int j=;j<=;j++){
if(j>=we[i])
dp[j]+=dp[j-we[i]];
}
}
cout<<fixed<<showpoint<<setprecision();
while(cin>>ss&&ss){
cout<<setw()<<ss<<setw()<<dp[(int)(*ss+0.5)]<<endl;//注意这里加0.5.是为了减少误差
} }

Dollars的更多相关文章

  1. uva 147 Dollars

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

  2. 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 ...

  3. 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 ...

  4. uva 147 Dollars(完全背包)

    题目连接:147 - Dollars 题目大意:有11种硬币, 现在输入一个金额, 输出有多少种组成方案. 解题思路:uva 674 的升级版,思路完全一样, 只要处理一下数值就可以了. #inclu ...

  5. Not a million dollars ——a certain kind of ingenuity, discipline, and proactivity that most people seem to lack

    原文:http://ryanwaggoner.com/2010/12/you-dont-really-want-a-million-dollars/a certain kind of ingenuit ...

  6. Gadgets for dollars and pounds CodeForces - 609D

    Nura wants to buy k gadgets. She has only sburles for that. She can buy each gadget for dollars or f ...

  7. 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 ...

  8. codeforces 609D D. Gadgets for dollars and pounds(二分+贪心)

    题目链接: D. Gadgets for dollars and pounds time limit per test 2 seconds memory limit per test 256 mega ...

  9. BNUOJ 17286 Dollars

    Dollars Time Limit: 3000ms Memory Limit: 131072KB This problem will be judged on UVA. Original ID: 1 ...

  10. uva147 Dollars ——完全背包

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

随机推荐

  1. Nginx+Keepalived 实现双击热备及负载均衡

    Nginx master : 10.1.58.191   Nginx负载均衡主机 Nginx  slave    : 10.1.58.181   Nginx负载均衡备机Nginx_VIP_TP: 10 ...

  2. linux的文件系统及节点表

    linux的文件系统及节点表 一  linux的文件系统1 我们都知道当我们安装linux时会首先给系统分区,然后我们会把分区格式化成EXT3格式的文件系统.那么在linux系统中还有没有其他的文件系 ...

  3. thinkphp实现短信验证注册

    前言 注册时经常需要用到短信验证码,本文记录一下思路和具体实现. 短信验证平台使用云片,短信验证码的生成使用thinkphp. 思路 1.用户输入手机号,请求获取短信验证码. 2.thinkphp生成 ...

  4. 详解SSH框架的原理和优点

    Struts的原理和优点.        Struts工作原理  MVC即Model-View-Controller的缩写,是一种常用的设计模式.MVC 减弱了业务逻辑接口和数据接口之间的耦合,以及让 ...

  5. EXCEL插件

    http://www.cnblogs.com/brooks-dotnet/category/233027.html http://www.360doc.com/content/15/0713/00/1 ...

  6. android 蓝牙4.0 开发介绍

    最近一直在研究一个蓝牙功能 由于本人是菜鸟  学起来比较忙 一直搞了好久才弄懂 , 网上对蓝牙4.0也就是几个个dome 抄来抄去,全是英文注解 , 对英语不好的朋友来说 真是硬伤 , 一些没必要的描 ...

  7. NetAdvantage webdatagrid 控件的一些属性

    属性: 1 behaviors 行为下的属性集合 Row Selectors 主要用于设置行选择样式与形为的集合 Enable 属性表示是否启用 Row Selectors下的属性设置 RowNumB ...

  8. mysql locktables

    SELECT      r.trx_id waiting_trx_id,      r.trx_mysql_thread_id waiting_thread,      TIMESTAMPDIFF(  ...

  9. oracle 中查看一张表是否有主键,主键在哪个字段上的语句怎么查如要查aa表,

    select a.constraint_name, a.column_name from user_cons_columns a, user_constraints b where a.constra ...

  10. 用sed、awk、grep同时匹配多个条件(与模式、或模式)

    同时匹配ABC 和 123:sed -n '/ABC/{/123/p}' awk '/ABC/&&/123/{ print $0 }' grep -E '(ABC.*123|123.* ...