結果
問題 |
No.67 よくある棒を切る問題 (1)
|
ユーザー |
![]() |
提出日時 | 2018-02-06 14:43:40 |
言語 | Java (openjdk 23) |
結果 |
RE
|
実行時間 | - |
コード長 | 573 bytes |
コンパイル時間 | 5,132 ms |
コンパイル使用メモリ | 75,476 KB |
実行使用メモリ | 70,044 KB |
最終ジャッジ日時 | 2025-03-03 11:07:57 |
合計ジャッジ時間 | 29,364 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 14 RE * 16 |
ソースコード
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); } }