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 |
Re:run-time error...java求救In Reply To:run-time error...java求救 Posted by:6503548 at 2009-11-20 16:30:54 处理输入 在外层加一个 while(in.hasNext()) 试试。 > import java.util.Scanner; > public class EX1005 { > > public static void main (String[] args) { > Scanner keyboard=new Scanner(System.in); > int N=keyboard.nextInt(); > int []p=new int[N]; > for (int i=0;i<N;i++) { > double x=keyboard.nextInt(); > double y=keyboard.nextInt(); > double r0=Math.sqrt(x*x+y*y); > int j; > for (j=1;;j++) { > if (Math.sqrt(100*j/Math.PI)>r0) { > break; > } > } > p[i]=j; > > } > for (int i=1;i<=N;i++) { > System.out.println("Property "+i+": This property will begin eroding in year "+p[i-1]+"."); > } > System.out.println("END OF OUTPUT."); > } > > > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator