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

Re:...想明白了你会发现很简单。。。看讨论的人比较多,,我也来说说,,呵呵

Posted by kongsiyuan at 2011-10-09 10:33:58 on Problem 1922
In Reply To:...想明白了你会发现很简单。。。看讨论的人比较多,,我也来说说,,呵呵 Posted by:TangMing at 2009-08-12 19:54:58
> 1,时间为负数的不用管,直接去掉,因为如果你可以追得上他(A),那么说明你的速度比他快,那么你不会去跟他(A)走的,如果追不上,那更加不用说
> 2,找一个达到时间最少的,输出这个答案就行了,,因为用时最少那么他一定会追上你,你一定会最后跟着他走,他到达的时间也就是你达到的最少时间了(这里的t=s/v+t0)
> 3,精度问题,比如得到1.1,你就应该输出2,那么就是if(aa-(int)aa>0.0)的问题了
> #include<iostream>
> #include<cmath>
> int main()
> {
>   int n,i,v,t,tt,ans=INT_MAX;
>   while(scanf("%d",&n)!=EOF,n)
>   {
> 	int j=0;
>     for(i=0;i<n;i++)
> 	{
> 	   scanf("%d%d",&v,&t);
> 	   if(t>=0)	  
> 	   { 
> 		   double aa=(4500.0/(v*10.0/36.0));
> 		   if(aa-(int)aa>0.0)aa++;
> 		   tt=aa+t;
> 		   if(tt<ans)ans=tt;}
> 	}
> 	printf("%d\n",ans);
> 	ans=INT_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