結果
問題 | No.67 よくある棒を切る問題 (1) |
ユーザー | moecocoa |
提出日時 | 2018-02-06 14:47:52 |
言語 | Java21 (openjdk 21) |
結果 |
RE
|
実行時間 | - |
コード長 | 630 bytes |
コンパイル時間 | 2,672 ms |
コンパイル使用メモリ | 71,912 KB |
実行使用メモリ | 65,272 KB |
最終ジャッジ日時 | 2023-09-25 07:27:41 |
合計ジャッジ時間 | 25,596 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 934 ms
64,340 KB |
testcase_01 | RE | - |
testcase_02 | RE | - |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | AC | 874 ms
64,552 KB |
testcase_07 | RE | - |
testcase_08 | RE | - |
testcase_09 | AC | 912 ms
64,556 KB |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | AC | 838 ms
64,928 KB |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | AC | 905 ms
64,732 KB |
testcase_16 | AC | 893 ms
65,116 KB |
testcase_17 | AC | 866 ms
64,552 KB |
testcase_18 | AC | 858 ms
64,520 KB |
testcase_19 | AC | 911 ms
64,968 KB |
testcase_20 | AC | 930 ms
62,840 KB |
testcase_21 | AC | 955 ms
65,080 KB |
testcase_22 | AC | 811 ms
64,944 KB |
testcase_23 | AC | 832 ms
62,784 KB |
testcase_24 | AC | 122 ms
56,408 KB |
testcase_25 | RE | - |
testcase_26 | RE | - |
testcase_27 | AC | 188 ms
56,144 KB |
testcase_28 | RE | - |
testcase_29 | RE | - |
testcase_30 | RE | - |
ソースコード
import java.util.*; import java.io.*; public class Main{ static int N; static int[] l; static int K; public static void main(String[] args) { Scanner sc = new Scanner(System.in); N = sc.nextInt(); l = new int[N]; for(int i=0; i<N; i++){ l[i] = sc.nextInt(); } K = sc.nextInt(); double lb = 0, ub = 1e12; for(int cnt = 0; cnt < 100; cnt++) { // while (ub - lb > 1) double mid = (lb + ub) / 2; if (mid < 1e-10) { lb = mid; continue; } int sum = 0; for(int i=0; i<N; i++){ sum += l[i] / mid; } if (sum >= K) lb = mid; else ub = mid; } System.out.println(lb); } }