結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー htensaihtensai
提出日時 2020-01-14 20:29:52
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 762 bytes
コンパイル時間 2,132 ms
コンパイル使用メモリ 71,180 KB
実行使用メモリ 69,216 KB
最終ジャッジ日時 2023-08-27 02:14:26
合計ジャッジ時間 17,753 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 725 ms
69,216 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        int k = sc.nextInt();
        double left = 0.0000000001;
        double right = 1000000000;
        while (right - left > 0.00000000001) {
            double m = (left + right) / 2;
            int count = 0;
            for (int i = 0; i < n; i++) {
                count += (int)(arr[i] / m);
            }
            if (count < k) {
                right = m;
            } else {
                left = m;
            }
        }
        System.out.println(left);
    }
}
0