UVa 147 Dollars(完全背包)
2024-10-14 02:50:44
https://vjudge.net/problem/UVA-147
题意:
换零钱,计算方案数。
思路:
完全背包,UVa674的加强版。
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std; const int maxn = + ;
int coin[] = { , , , , , , , , , , };
long long d[maxn]; int main()
{
//freopen("D:\\txt.txt", "r", stdin);
int i, j;
memset(d, , sizeof(d));
d[] = ;
for (int i = ; i < ;i++)
for (int j = coin[i]; j <= maxn; j++)
d[j] += d[j - coin[i]];
double s;
while (cin >> s && s)
{
int n = (int)( * s + 0.5);
printf("%6.2lf%17lld\n", s,d[n]);
}
return ;
}
最新文章
- 安装 log.io 实时监控 php_error 日志
- iOS10遇到有推送的Demo真机报错的解决
- [spring源码学习]一、IOC简介
- SQL Server中事务、锁定和阻塞
- WinForm开发-界面控件到实体,实体到界面控件自动绑定
- cocos2d-x 3.10 屏幕适配问题
- sql语句操作
- Public and Private Interfaces in ruby
- 【BZOJ】2209: [Jsoi2011]括号序列(splay)
- PHP 迭代器模式
- UVALive 5135 Mining Your Own Business 双连通分量 2011final
- session marked for kill处理oracle中杀不掉的锁
- POJ burnside&;&;polya整理练习
- CH Round #53 -【Nescaf&#233; 32】杯NOIP模拟赛
- PHP学习笔记,自己动手写个MVC的框架 -- base所有代码
- 初试LIBSVM
- Gist - ES6 Proxy
- SpringBoot入坑-项目搭建
- JavaSE(一)之类与对象
- 微软黑科技强力注入,.NET C#全面支持人工智能