HDU1203(01)
来源:互联网 发布:mac air快捷键大全 编辑:程序博客网 时间:2024/05/17 01:13
#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#include <map>#include <stack>#include <queue>#include <list>#include <cmath>using namespace std;#define cir(a,b) memset(a,b,sizeof a)typedef long long LL;const int maxn = 100000+10;const int INF = 1e9+10;int n,m;double w[maxn];int v[maxn];double dp[maxn];int main(){ while (cin >> n >> m ) { if(m==0&&n==0) break; cir(w,0); cir(v,0); cir(dp,0); for(int i=0;i<=n;i++) dp[i] = 1; for(int i=0;i<m;i++) { cin >> v[i] >> w[i]; w[i] = 1-w[i]; } for(int i=0;i<m;i++) { for(int j=n;j>=v[i];j--) { dp[j] = min(dp[j],dp[j-v[i]]*w[i]); } } printf("%.1f%%\n",(1.0-dp[n])*100); } return 0;}
阅读全文
0 0
- HDU1203(01)
- HDU1203 01背包
- hdu1203(01背包)
- HDU1203(01背包)
- hdu1203 01背包
- hdu1203(01背包)
- hdu1203(01背包)
- HDU1203 DP-01背包
- hdu1203 01背包问题
- hdu1203-01背包
- hdu1203
- HDU1203
- HDU1203
- hdu1203
- hdu1203
- hdu1203
- hdu1203
- HDU1203 简单01背包问题
- oracle 查询总结
- idea常用的功能
- 计算精度以及roc曲线
- php Can't use function return value in write context
- hibernate 缓存介绍与缓存使用方式
- HDU1203(01)
- 并发实例,10000个http请求同时访问tomcat,tomcat是怎么处理的?
- 百钱买百鸡
- Linux下查看查询慢日志
- Hibernate泛型Dao
- 用C++封装线程池
- 三大国产品牌,苹果遭到蚕食
- Java Web工程转换为基于Maven的Web工程
- volatile关键字解析