Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
不知道为什么老是WA。请大侠帮忙看看。#include <stdio.h> //#include <conio.h> typedef struct { int a; //bandwidth int b; //price float ab; // B/P }manu; int main() { int t, n, mi, i, j, price, bw; float bp; manu manufa[120][120]; manu max[120]; // freopen("1018.dat", "r", stdin); scanf("%d", &t); while(t--) { scanf("%d", &n); i = 0; price = 0; bw = 99999999; while(i<n) { scanf("%d", &mi); max[i].ab = 0; for(j=0; j<mi; j++) { scanf("%d%d", &manufa[i][j].a, &manufa[i][j].b); if(manufa[i][j].b == 0) { manufa[i][j].ab = manufa[i][j].a*1.0; } else {manufa[i][j].ab = manufa[i][j].a * 1.0 / manufa[i][j].b;} if(max[i].ab < manufa[i][j].ab) max[i] = manufa[i][j]; //找出性价比最大的 } price += max[i].b; //求总价 if(max[i].a < bw) bw = max[i].a; //性价比最大的中的最小带宽 i++; } bp = bw*1.0 / price; // B/P printf("%.3f\n", bp); } // getch(); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator