結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー uafr_csuafr_cs
提出日時 2015-09-07 01:49:57
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 813 bytes
コンパイル時間 2,365 ms
コンパイル使用メモリ 73,300 KB
実行使用メモリ 67,108 KB
最終ジャッジ日時 2023-09-26 09:52:24
合計ジャッジ時間 18,843 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 911 ms
67,108 KB
testcase_01 AC 134 ms
55,848 KB
testcase_02 AC 601 ms
62,268 KB
testcase_03 AC 834 ms
64,900 KB
testcase_04 AC 907 ms
66,704 KB
testcase_05 AC 869 ms
66,808 KB
testcase_06 AC 852 ms
66,700 KB
testcase_07 AC 896 ms
66,840 KB
testcase_08 AC 900 ms
66,692 KB
testcase_09 TLE -
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-10;
		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