제출 #604447

#제출 시각아이디문제언어결과실행 시간메모리
604447bzhu524Mobile (BOI12_mobile)Java
컴파일 에러
0 ms0 KiB
import java.util.*; import java.io.*; public class MobileBalticOI { public static void main(String[] args) { FastIO io = new FastIO(); int n = io.nextInt(); int len = io.nextInt(); long[][] points = new long[n][n]; for (int i=0; i<n; i++) { long x = io.nextLong(); long y = io.nextLong(); points[i][0] = x; points[i][1] = y; } double lower = 1; double upper = 10e9; double res = Double.MAX_VALUE; while (upper - lower >= 10e-4) { double mid = (upper + lower) / 2; double curr = 0; for (int i=0; i<n; i++) { long x = points[i][0]; long y = points[i][1]; double delta = Math.sqrt(mid * mid - y * y); double dist1 = x - delta; double dist2 = x + delta; if (dist1 <= curr) { curr = Math.max(curr, dist2); } } if (curr < len) { lower = mid; } else { upper = mid; res = Math.min(res, mid); } } String r = String.format("%.6f", res); System.out.println(r); } static class FastIO extends PrintWriter { private InputStream stream; private byte[] buf = new byte[1<<16]; private int curChar, numChars; // standard input public FastIO() { this(System.in,System.out); } public FastIO(InputStream i, OutputStream o) { super(o); stream = i; } // file input public FastIO(String i, String o) throws IOException { super(new FileWriter(o)); stream = new FileInputStream(i); } // throws InputMismatchException() if previously detected end of file private int nextByte() { if (numChars == -1) throw new InputMismatchException(); if (curChar >= numChars) { curChar = 0; try { numChars = stream.read(buf); } catch (IOException e) { throw new InputMismatchException(); } if (numChars == -1) return -1; // end of file } return buf[curChar++]; } // to read in entire lines, replace c <= ' ' // with a function that checks whether c is a line break public String next() { int c; do { c = nextByte(); } while (c <= ' '); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = nextByte(); } while (c > ' '); return res.toString(); } public int nextInt() { // nextLong() would be implemented similarly int c; do { c = nextByte(); } while (c <= ' '); int sgn = 1; if (c == '-') { sgn = -1; c = nextByte(); } int res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res = 10*res+c-'0'; c = nextByte(); } while (c > ' '); return res * sgn; } public double nextDouble() { return Double.parseDouble(next()); } public long nextLong() { return Long.parseLong(next()); } } }

컴파일 시 표준 에러 (stderr) 메시지

mobile.java:5: error: class MobileBalticOI is public, should be declared in a file named MobileBalticOI.java
public class MobileBalticOI {
       ^
1 error