poj 1018 dp
来源:互联网 发布:景区历年游客数据统计 编辑:程序博客网 时间:2024/06/05 06:32
#include<cstdio>#include<cstring>#define INF 0x3f3f3f3f#define MAX(x,y) ((x)>(y)?(x):(y))#define MIN(x,y) ((x)>(y)?(y):(x))int dp[120][400];int main(){int T;scanf("%d",&T);while(T--){int n;scanf("%d",&n);memset(dp,0x3f,sizeof(dp));for(int i=1;i<=n;i++){int num;scanf("%d",&num);while(num--){int b,p;scanf("%d%d",&b,&p);if(i==1){dp[i][b]=MIN(dp[i][b],p);}else{for(int k=1;k<=400;k++){if(dp[i-1][k]!=INF){ if(b>=k) dp[i][k]=MIN(dp[i][k],dp[i-1][k]+p); else dp[i][b]=MIN(dp[i][b],dp[i-1][k]+p); }}}}}double res=0;for(int i=0;i<=400;i++){if(dp[n][i]!=INF){res=MAX(res,(double)i/dp[n][i]);}}printf("%.3lf\n",res);}}
0 0
- poj 1018 DP
- poj 1018 dp
- POJ 1018(dp)
- poj 1018 dp
- poj 1018 dp
- POJ 1018 Communication System (DP)
- POJ 1018 Communication System dp
- POJ 1018:Communication System - DP
- POJ 1018Communication System(DP)
- poj 1018 Communication System(DP)
- poj dp
- 【dp】POJ
- 【dp】POJ
- [DP] POJ
- [DP] POJ
- [DP] POJ
- 【dp】POJ
- poj 1018 Communication System DP思想
- C语言基础:字符输入/输出验证
- weston快捷键
- 测试工具比较
- 1072. Gas Station (30)
- 2016.4.30
- poj 1018 dp
- 剑指offer-面试题58-二叉树的下一个结点
- Spark源码学习笔记4-SparkEnv
- Android轮播图效果的各种实现
- CURL
- HDU
- Java工具类——文件操作
- MVP架构在Android平台上的实现分析(一)
- 快速排序及其改进