結果
問題 | No.67 よくある棒を切る問題 (1) |
ユーザー | Grenache |
提出日時 | 2016-05-18 19:46:30 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 489 ms / 5,000 ms |
コード長 | 1,771 bytes |
コンパイル時間 | 3,919 ms |
コンパイル使用メモリ | 78,972 KB |
実行使用メモリ | 62,052 KB |
最終ジャッジ日時 | 2024-11-08 11:52:23 |
合計ジャッジ時間 | 17,718 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 471 ms
60,276 KB |
testcase_01 | AC | 128 ms
40,920 KB |
testcase_02 | AC | 322 ms
50,896 KB |
testcase_03 | AC | 455 ms
57,364 KB |
testcase_04 | AC | 442 ms
56,868 KB |
testcase_05 | AC | 435 ms
56,856 KB |
testcase_06 | AC | 455 ms
57,468 KB |
testcase_07 | AC | 464 ms
61,320 KB |
testcase_08 | AC | 463 ms
61,540 KB |
testcase_09 | AC | 451 ms
61,412 KB |
testcase_10 | AC | 415 ms
56,416 KB |
testcase_11 | AC | 459 ms
56,836 KB |
testcase_12 | AC | 453 ms
57,256 KB |
testcase_13 | AC | 454 ms
61,780 KB |
testcase_14 | AC | 442 ms
61,360 KB |
testcase_15 | AC | 487 ms
57,672 KB |
testcase_16 | AC | 489 ms
58,220 KB |
testcase_17 | AC | 432 ms
56,876 KB |
testcase_18 | AC | 438 ms
57,268 KB |
testcase_19 | AC | 460 ms
62,052 KB |
testcase_20 | AC | 461 ms
61,748 KB |
testcase_21 | AC | 461 ms
61,868 KB |
testcase_22 | AC | 433 ms
56,424 KB |
testcase_23 | AC | 428 ms
56,432 KB |
testcase_24 | AC | 113 ms
40,144 KB |
testcase_25 | AC | 166 ms
41,824 KB |
testcase_26 | AC | 145 ms
41,524 KB |
testcase_27 | AC | 137 ms
41,308 KB |
testcase_28 | AC | 283 ms
47,892 KB |
testcase_29 | AC | 215 ms
43,272 KB |
testcase_30 | AC | 161 ms
41,784 KB |
ソースコード
import java.io.*; import java.util.*; public class Main_yukicoder67 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Printer pr = new Printer(System.out); int n = sc.nextInt(); int[] l = new int[n]; for (int i = 0; i < n; i++) { l[i] = sc.nextInt(); } long k = sc.nextLong(); double ll = 0; double rr = 1_000_000_000; for (int i = 0; i < 100; i++) { double mid = ll + (rr - ll) / 2; if (isOK(mid, l, k)) { ll = mid; } else { rr = mid; } } pr.printf("%.10f\n", rr); pr.close(); sc.close(); } private static boolean isOK(double mid, int[] l, long k) { long cnt = 0; for (int e : l) { cnt += (long)(e / mid); } return cnt >= k; } @SuppressWarnings("unused") private static class Scanner { BufferedReader br; Iterator<String> it; Scanner (InputStream in) { br = new BufferedReader(new InputStreamReader(in)); } String next() throws RuntimeException { try { if (it == null || !it.hasNext()) { it = Arrays.asList(br.readLine().split(" ")).iterator(); } return it.next(); } catch (IOException e) { throw new IllegalStateException(); } } int nextInt() throws RuntimeException { return Integer.parseInt(next()); } long nextLong() throws RuntimeException { return Long.parseLong(next()); } float nextFloat() throws RuntimeException { return Float.parseFloat(next()); } double nextDouble() throws RuntimeException { return Double.parseDouble(next()); } void close() { try { br.close(); } catch (IOException e) { // throw new IllegalStateException(); } } } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } }