标签:des style blog class code java
Time Limit: 1000MS | Memory Limit: 10000K | |
Total Submissions: 22380 | Accepted: 7953 |
Description
Input
Output
Sample Input
1 3 3 100 25 150 35 80 25 2 120 80 155 40 2 100 100 120 110
Sample Output
0.649
Source
1 //232K 47MS C++ 1164B 2014-05-07 19:16:42 2 #include<stdio.h> 3 #include<string.h> 4 #include<stdlib.h> 5 struct node{ 6 int b; 7 int p; 8 }a[105][105]; 9 int b[105]; 10 int n; 11 inline int Max(int x,int y) 12 { 13 return x>y?x:y; 14 } 15 inline int Min(int x,int y) 16 { 17 return x<y?x:y; 18 } 19 int main(void) 20 { 21 int t,m; 22 scanf("%d",&t); 23 while(t--) 24 { 25 scanf("%d",&n); 26 int ln=0x7ffffff,rn=0; 27 for(int i=0;i<n;i++){ 28 scanf("%d",&b[i]); 29 for(int j=0;j<b[i];j++){ 30 scanf("%d%d",&a[i][j].b,&a[i][j].p); 31 ln=Min(ln,a[i][j].b); 32 rn=Max(rn,a[i][j].b); 33 } 34 } 35 double ans=0; 36 for(int i=ln;i<=rn;i++){ 37 int sminn=0; 38 for(int j=0;j<n;j++){ 39 int minn=0x7ffffff; 40 for(int k=0;k<b[j];k++){ 41 if(a[j][k].b>=i && minn>a[j][k].p) 42 minn=a[j][k].p; 43 } 44 sminn+=minn; 45 } 46 ans=ans>(i*1.0/sminn)?ans:(i*1.0/sminn); 47 //printf("*****%lf\n",ans); 48 } 49 printf("%.3lf\n",ans); 50 } 51 return 0; 52 }
poj 1018 Communication System (枚举),布布扣,bubuko.com
poj 1018 Communication System (枚举)
标签:des style blog class code java
原文地址:http://www.cnblogs.com/GO-NO-1/p/3714459.html