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. Delphi 颜色转换

    http://files.cnblogs.com/xe2011/StringToColor.rar unit Unit1; interface uses Windows, Messages, SysU ...

  2. [RxJS] Transformation operator: repeat

    Operator repeat() is somewhat similar to retry(), but is not for handling operators. In this lesson ...

  3. [转] 三步将你的 React Native 项目运行在 Web 浏览器上面

    React Native 的出现,让前端工程师拥有了使用 JavaScript 编写原生 APP 的能力.相比之前的 Web app 来说,对于性能和用户体验提升了非常多. 但是 React Nati ...

  4. css考核点整理(十三)-jpg/png/gif等图片类型区别

    jpg/png/gif等图片类型区别

  5. 【Android】面试宝典

    Android面试 1. 内容介绍................................................................................... ...

  6. Oracler读取各种格式的相关日期格式

    CREATE OR REPLACE Package Pkg_Stm_Date As     --Purpose:相关日期处理功能包          --获取某一天是第几周     Function ...

  7. 各大浏览器CSS Hack收集

    各大浏览器CSS Hack收集  >>>>>>>>>>>>>>>>>>>>> ...

  8. Android 5.0以上手机出现找不到so文件

    问题描述 最近做项目出了一个bug项目中用到so文件,在5.0以上的手机上会报一个初始化异常错误,并提示找不到so文件.lib里目录结构类似如下  在Android5以下都没有问题,在5.0以上会报错 ...

  9. 分布式发布订阅消息系统 Kafka 架构设计[转]

    分布式发布订阅消息系统 Kafka 架构设计 转自:http://www.oschina.net/translate/kafka-design 我们为什么要搭建该系统 Kafka是一个消息系统,原本开 ...

  10. 强大的Core Image框架,各种滤镜处理图像

    首先介绍一下Core Image,他是一个很强大的图像处理框架,他可以让你简单的应用各种滤镜来处理图像,比如说色相,饱和度,亮度等等...他是运用GPU(CPU)实时地处理图像数据和视频的帧.而且Co ...