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 |
有什么 错 啊In Reply To:好心人 Posted by:yanlimin9 at 2006-09-22 21:54:40 import java.io.*; import java.util.*; public class Main { public static void main(String arg[]) throws Exception { BufferedReader buffer=new BufferedReader(new InputStreamReader(System.in)); String str=buffer.readLine(); int arr_time,last=1000; int num=Integer.parseInt(str); Vector vc=new Vector(10,2); int ii,jj,kk; int speed; float tmp; StringTokenizer st; while(num!=0) { for(ii=0,last=1000;ii<num;ii++) { str=buffer.readLine(); st=new StringTokenizer(str); speed=Integer.parseInt(st.nextToken()); kk=Integer.parseInt(st.nextToken()); if(kk>=0) { tmp=(float)(3600*4.5)/speed+kk; /*printf("tmp:%f %d",tmp,(int)tmp);*/ // System.out.println(tmp); if(tmp-(int)tmp<.001) arr_time=(int )tmp; else arr_time=1+(int )tmp; last= ( arr_time<last)?arr_time:last; } //stem.out.println(last); } Integer it=new Integer(last); vc.add(it); str=buffer.readLine(); num=Integer.parseInt(str); } while(!vc.isEmpty()) { System.out.println(((Integer)vc.firstElement()).intValue()); vc.remove(0); } //其实最佳的就是最早的,简单的问题莫夫扎花 } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator