| ||||||||||
| 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 > 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.");
> }
>
>
> }
把程序里的next.int改成nextDouble就可以了,我试过了。
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator