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 hnlwt123 at 2008-08-05 15:46:43 on Problem 1922
In Reply To:Re:两组数据的答案都对了,为什么还WA?帮帮忙。 Posted by:hnlwt123 at 2008-08-05 15:41:03
   要用double型的,而且要用ceil函数取整
#include<stdio.h>
#include<math.h>
void main()
{
      int i,n;
	  double t,min,VT[10001][2];
	  scanf("%d",&n);
	  while(n!=0)
	  {
		  min=100000000;
		  for(i=0;i<n;i++)
		  {
			  scanf("%lf %lf",&VT[i][0],&VT[i][1]);
			  if(VT[i][1]>=0)
			  {
				  t=4500*3.6/VT[i][0]+VT[i][1];
				  if(min>t)
					  min=t;
				  min=ceil(min);
			  }
		  }
		  printf("%.0f\n",min);
		  scanf("%d",&n);
	  }
}
这样就可以了


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