結果
問題 |
No.67 よくある棒を切る問題 (1)
|
ユーザー |
![]() |
提出日時 | 2020-01-14 20:29:52 |
言語 | Java (openjdk 23) |
結果 |
RE
|
実行時間 | - |
コード長 | 762 bytes |
コンパイル時間 | 2,683 ms |
コンパイル使用メモリ | 76,520 KB |
実行使用メモリ | 77,948 KB |
最終ジャッジ日時 | 2025-03-03 11:30:36 |
合計ジャッジ時間 | 14,138 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 RE * 5 TLE * 1 -- * 23 |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr = new int[n]; for (int i = 0; i < n; i++) { arr[i] = sc.nextInt(); } int k = sc.nextInt(); double left = 0.0000000001; double right = 1000000000; while (right - left > 0.00000000001) { double m = (left + right) / 2; int count = 0; for (int i = 0; i < n; i++) { count += (int)(arr[i] / m); } if (count < k) { right = m; } else { left = m; } } System.out.println(left); } }