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 <iostream> using namespace std; struct DEV { int band; int price; }; DEV device[120][11]; int main() { int cas, n, i, j, ii, jj; float small_res; cin>>cas; while( cas-- ) { cin>>n; for( i=1 ; i<=n ; i++) { cin>>device[i][0].band; for(j=1; j<=device[i][0].band ;j++) { cin>>device[i][j].band >> device[i][j].price; } } int min_band, min_price, total; small_res=0.0; for(ii=1; ii<=n ; ii++) { for(jj=1 ; jj<=device[ii][0].band ; jj++) { min_band = device[ii][jj].band; total=device[ii][jj].price; for(i=1 ; i<=n ; i++) { if(i == ii) continue; min_price = 10000001; for(j=1 ; j<=device[i][0].band ; j++) { if(device[i][j].band >= min_band && device[i][j].price < min_price) { min_price = device[i][j].price; } } total += min_price; if(min_price == 10000001) { break; } } if(min_price ==10000001) break; float dp = (float)min_band / (float)total; if(dp > small_res) { small_res = dp; } } } printf("%.3f\n",small_res); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator