結果
問題 |
No.67 よくある棒を切る問題 (1)
|
ユーザー |
![]() |
提出日時 | 2015-09-07 01:49:57 |
言語 | Java (openjdk 23) |
結果 |
TLE
|
実行時間 | - |
コード長 | 813 bytes |
コンパイル時間 | 2,453 ms |
コンパイル使用メモリ | 78,448 KB |
実行使用メモリ | 72,176 KB |
最終ジャッジ日時 | 2025-03-03 10:24:13 |
合計ジャッジ時間 | 17,634 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 9 TLE * 1 -- * 20 |
ソースコード
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); } }