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 |
哪位大牛能看出这个代码错在哪?#include<iostream> #include<algorithm> using namespace std; int b[1010][1010],p[1010][1010],n[1010],a[1010],kk; int main(void) { int t,m; int i,j,k; int sump,tmin; double max; while(1==scanf("%d",&t)) { while(t--) { kk = 0; scanf("%d",&m); for(i=0;i<m;i++) { scanf("%d",&n[i]); for(j=0;j<n[i];j++) { scanf("%d %d",&b[i][j],&p[i][j]); a[kk] = b[i][j]; kk++; } } sort(a, a + kk ); max=0.0; for(i = 0;i< kk;i ++) { sump=0; for(j = 0;j < m;j ++) { tmin = 9999999; for(k = 0; k < n[j];k ++) if(b[j][k] >= a[i] && p[j][k] < tmin) tmin=p[j][k]; sump+=tmin; } if((double)a[i]/(double)sump>max) max=(double)a[i]/(double)sump; } printf("%.3f\n",max); } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator