結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー uafr_csuafr_cs
提出日時 2015-09-07 01:49:16
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 813 bytes
コンパイル時間 2,110 ms
コンパイル使用メモリ 74,152 KB
実行使用メモリ 134,392 KB
最終ジャッジ日時 2023-09-26 09:51:42
合計ジャッジ時間 14,541 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 933 ms
134,392 KB
testcase_01 AC 135 ms
56,124 KB
testcase_02 AC 608 ms
61,652 KB
testcase_03 AC 843 ms
65,152 KB
testcase_04 AC 881 ms
66,724 KB
testcase_05 AC 901 ms
67,224 KB
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.Arrays;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		final int N = sc.nextInt();
		long[] input = new long[N];
		for(int i = 0; i < N; i++){
			input[i] = sc.nextLong();
		}
		final long K = sc.nextLong();
		
		final double EPS = 1e-11;
		double upper = Arrays.stream(input).max().getAsLong();
		double lower = Double.MIN_VALUE;
		
		while((upper - lower) > EPS){
			final double middle = (upper + lower) / 2;
			
			long count = 0;
			for(int i = 0; i < N; i++){
				count += input[i] / middle;
			}
			
			if(count >= K){
				lower = middle;
			}else{
				upper = middle;
			}
		}
		
		System.out.printf("%.12f\n", lower);
	}

}
0