|
|
вернуться в форумProblem with Java Code ================================================================= import java.util.*; import java.io.*; public class t1020 { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int N = in.nextInt(); Double R = in.nextDouble(); Double[] x = new Double[N]; Double[] y = new Double[N]; double len = 2 * Math.PI * R; for(int i = 0; i < N; i ++) { x[i] = in.nextDouble(); y[i] = in.nextDouble(); } for(int i = 0; i < N - 1; i ++) len += Math.sqrt(Math.pow((x[i] - x[i == 0 ? N - 1 : i - 1]), 2) + Math.pow((y[i] - y[i == 0 ? N - 1 : i - 1]), 2)); out.println(len); out.flush(); } } ================================================================ Write: ================================================================ 4 1.0 Exception in thread "main" java.util.InputMismatchException at java.util.Scanner.throwFor(Unknown Source) at java.util.Scanner.next(Unknown Source) at java.util.Scanner.nextDouble(Unknown Source) at t1020.main(t1020.java:12) ================================================================= Why I can not read 1.0?! 4 1 -- Read correctly!!! |
|
|