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

郁闷了一上午,删除所有优化后AC了

Posted by xnby at 2005-12-03 11:51:21 on Problem 1018
#include<stdio.h>
main()
{
 int b[100][100],m[100],p[100][100];
 int i,j,k,l,bmax,bmin,sump,t,n,tmin;
 double max;
 scanf("%d",&t);
 for(i=0;i<t;i++)
  {
   bmax=0;bmin=32767;
   scanf("%d",&n);
   for(j=0;j<n;j++)
     {
      scanf("%d",&m[j]);
      for(k=0;k<m[j];k++)
	   {
	     scanf("%d%d",&b[j][k],&p[j][k]);
	     if (bmax<b[j][k]) bmax=b[j][k];
		 if (bmin>b[j][k]) bmin=b[j][k];
	  }
     }
   max=0.0;
   for(j=bmin;j<=bmax;j++)
      {
	     sump=0;
         for(k=0;k<n;k++)
	      {
	      tmin=32767;
            for(l=0;l<m[k];l++)
		     if(b[k][l]>=j&&p[k][l]<tmin)
	           tmin=p[k][l];
	        sump+=tmin;
         }
         if((double)j/(double)sump>max)max=(double)j/(double)sump;
       }
    printf("%.3lf\n",max);
  }
} 
测试数据比较弱吧,在找最小值时出错,也照样AC了。

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