POJ 1018 Communication System
来源:互联网 发布:淘宝买家账号信誉查询 编辑:程序博客网 时间:2024/04/30 12:21
复杂度太高
//============================================================================
// Name : hello.cpp// Author : key
// Version : 8
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <string>
#include <algorithm>
using namespace std;
#define NUM_INF 0XFFFFF
int b[110][110];
int p[110][110];
int m[110];
int main()
{
int t;
int n;
int i,j,k;
int b_max;
int b_min;
int p_min;
int each_sum;
double ans;
double temp;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
b_min = NUM_INF;
b_max = 0;
for(i=0;i<n;i++)
{
scanf("%d",&m[i]);
for(j=0;j<m[i];j++)
{
scanf("%d%d",&b[i][j],&p[i][j]);
if(b[i][j]>b_max)
b_max = b[i][j];
if(b[i][j]<b_min)
b_min = b[i][j];
}
}
ans = 0.0;
for(i=b_min;i<=b_max;i++)
{
each_sum = 0;
for(j=0;j<n;j++)
{
p_min = NUM_INF;
for(k=0;k<m[j];k++)
{
if(b[j][k]>=i && p[j][k]<p_min)
p_min = p[j][k];
}
each_sum+=p_min;
}
// printf("%lf\n",temp);
temp = (double)i/(double)each_sum;
if(ans<temp)
ans = temp;
}
printf("%.3lf\n",ans);
}
return 0;
}
- poj 1018 Communication System
- POJ 1018 Communication System
- poj 1018 Communication System
- POJ 1018 Communication System
- POJ 1018 Communication System
- POJ 1018 Communication System
- poj 1018 Communication System
- POJ 1018 Communication System
- poj 1018 Communication System
- poj 1018 Communication System
- POJ 1018 Communication System
- poj 1018 Communication System
- poj 1018 Communication System
- poj-1018 Communication System
- POJ-1018 Communication System
- [POJ][1018]Communication System
- poj 1018Communication System
- poj 1018:Communication System
- POJ 2021 Relative Relatives
- POJ 2418 Hardwood Species
- 关闭Aphache和重启Apache
- 嵌入式C笔试总结(长期更新)
- 优化资源
- POJ 1018 Communication System
- POJ 1220 NUMBER BASE CONVERSION
- POJ1287 Networking
- POJ 1466 Girls and Boys
- POJ 1496 1850
- gt_opencv_helloworld_img_实现详解(一)
- 关于开通博客的声明
- POJ 1589 Unix ls
- POJ 2075 Tangled in Cables