Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

哪位大牛能看出这个代码错在哪?

Posted by jqacm at 2009-02-26 22:41:17 on Problem 1018
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator