結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー htensaihtensai
提出日時 2020-01-14 20:34:36
言語 Java21
(openjdk 21)
結果
AC  
実行時間 991 ms / 5,000 ms
コード長 748 bytes
コンパイル時間 2,110 ms
コンパイル使用メモリ 74,400 KB
実行使用メモリ 58,848 KB
最終ジャッジ日時 2024-04-26 00:56:03
合計ジャッジ時間 27,497 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 934 ms
58,100 KB
testcase_01 AC 125 ms
41,248 KB
testcase_02 AC 532 ms
48,492 KB
testcase_03 AC 902 ms
58,380 KB
testcase_04 AC 923 ms
58,808 KB
testcase_05 AC 863 ms
58,772 KB
testcase_06 AC 987 ms
58,780 KB
testcase_07 AC 956 ms
57,760 KB
testcase_08 AC 884 ms
57,992 KB
testcase_09 AC 917 ms
58,764 KB
testcase_10 AC 862 ms
58,524 KB
testcase_11 AC 821 ms
58,720 KB
testcase_12 AC 898 ms
58,692 KB
testcase_13 AC 837 ms
58,460 KB
testcase_14 AC 907 ms
57,972 KB
testcase_15 AC 920 ms
58,588 KB
testcase_16 AC 991 ms
58,848 KB
testcase_17 AC 904 ms
58,492 KB
testcase_18 AC 839 ms
58,468 KB
testcase_19 AC 958 ms
58,108 KB
testcase_20 AC 840 ms
58,072 KB
testcase_21 AC 968 ms
58,020 KB
testcase_22 AC 820 ms
58,400 KB
testcase_23 AC 988 ms
58,536 KB
testcase_24 AC 107 ms
40,432 KB
testcase_25 AC 222 ms
45,756 KB
testcase_26 AC 183 ms
43,100 KB
testcase_27 AC 187 ms
42,480 KB
testcase_28 AC 476 ms
48,156 KB
testcase_29 AC 330 ms
48,108 KB
testcase_30 AC 219 ms
45,656 KB
権限があれば一括ダウンロードができます

ソースコード

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();
        }
        long k = sc.nextLong();
        double left = 0;
        double right = 1000000000;
        for (int j = 0; j < 100; j++) {
            double m = (left + right) / 2;
            long count = 0;
            for (int i = 0; i < n; i++) {
                count += (long)(arr[i] / m);
            }
            if (count < k) {
                right = m;
            } else {
                left = m;
            }
        }
        System.out.println(left);
    }
}
0