結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー moetomatomoetomato
提出日時 2018-02-06 14:43:40
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 573 bytes
コンパイル時間 2,089 ms
コンパイル使用メモリ 72,648 KB
実行使用メモリ 65,240 KB
最終ジャッジ日時 2023-09-25 07:14:34
合計ジャッジ時間 27,094 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 940 ms
64,684 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 880 ms
64,996 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 912 ms
64,828 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 849 ms
64,480 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 AC 889 ms
64,664 KB
testcase_16 AC 942 ms
65,112 KB
testcase_17 AC 860 ms
65,240 KB
testcase_18 AC 950 ms
64,704 KB
testcase_19 AC 942 ms
64,484 KB
testcase_20 AC 941 ms
65,024 KB
testcase_21 AC 968 ms
64,504 KB
testcase_22 AC 813 ms
64,676 KB
testcase_23 AC 839 ms
64,764 KB
testcase_24 AC 122 ms
55,728 KB
testcase_25 RE -
testcase_26 RE -
testcase_27 AC 193 ms
56,144 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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;

			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);
	}
}
0