結果
| 問題 |
No.67 よくある棒を切る問題 (1)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-06-08 11:43:58 |
| 言語 | Java (openjdk 23) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 897 bytes |
| コンパイル時間 | 3,724 ms |
| コンパイル使用メモリ | 77,160 KB |
| 実行使用メモリ | 89,128 KB |
| 最終ジャッジ日時 | 2025-03-03 10:19:09 |
| 合計ジャッジ時間 | 15,991 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 1 -- * 29 |
ソースコード
import java.text.NumberFormat;
import java.util.Scanner;
public class Main0145 {
public static void main(String[] args) {
new Main0145();
}
public Main0145() {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
long[] l = new long[N];
for(int i=0;i<N;i++)
l[i] = sc.nextLong();
long K = sc.nextLong();
solve(N, l, K);
}
private void solve(int n, long[] l, long k) {
double res = 0;
double low = 0;
double high = Integer.MAX_VALUE;
while(high-low>1e-10){
long count = 0;
double mid = (high+low)/2;
for(long s: l){
count += s/mid;
}
// System.out.println(count + " " + mid);
if(count>=k){
low = mid;
res = mid;
}else{
high = mid;
}
}
NumberFormat format = NumberFormat.getInstance();
format.setGroupingUsed(false);
format.setMaximumFractionDigits(11);
System.out.println(format.format(res));
}
}