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 |
这份代码我感觉是错的,为什么ac了呢7# include <stdio.h> 8 9# define N 110 10# define MAX 342289 11 12int b[ N ][ N ],p[ N ][ N ]; 13int m[ N ]; 14 15int main() 16{ 17 int n; 18 int min_b, max_b; 19 int sum_p, min_p; 20 double max; 21 int T; scanf( "%d", &T ); 22 while ( T -- ) 23 { 24 max_b = 0; min_b = MAX; 25 scanf("%d",&n); 26 for( int i = 0; i < n; ++ i) 27 { 28 scanf( "%d", &m[i] ); 29 for( int j = 0; j < m[ i ]; ++ j ) 30 { 31 scanf( "%d %d", &b[ i ][ j ], &p[ i ][ j ] ); 32 if ( max_b < b[ i ][ j ] ) max_b = b[ i ][ j ]; 33 if ( min_b > b[ i ][ j ] ) min_b = b[ i ][ j ]; 34 } 35 } 36 max = 0.00; 37 for( int i = min_b; i <= max_b; ++ i) 38 { 39 sum_p = 0; 40 for( int j = 0; j < n; ++ j) 41 { 42 min_p = MAX; 43 for( int k = 0; k < m[ j ]; ++ k ) 44 { 45 if( b[ j ][ k ] >= i && p[ j ][ k ] < min_p ) 46 { 47 min_p = p[ j ][ k ]; 48 } 49 } 50 sum_p += min_p; 51 } 52 if( (double)i / (double)sum_p > max ) 53 { 54 max = (double)i / (double)sum_p; 55 } 56 } 57 printf( "%.3lf\n", max ); 58 } 59 return 0; 60} Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator