結果
| 問題 |
No.67 よくある棒を切る問題 (1)
|
| コンテスト | |
| ユーザー |
focus
|
| 提出日時 | 2018-01-12 15:18:17 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 669 bytes |
| コンパイル時間 | 598 ms |
| コンパイル使用メモリ | 66,376 KB |
| 実行使用メモリ | 8,480 KB |
| 最終ジャッジ日時 | 2025-03-03 11:06:53 |
| 合計ジャッジ時間 | 9,072 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 9 TLE * 1 -- * 20 |
ソースコード
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdio>
using namespace std;
typedef long long ll;
ll K;
vector<ll> L;
bool split(double num){
ll eda=0;
for(int i=0;i<L.size();i++){
eda+=L[i]/num;
}
if(eda>=K) return true;
return false;
}
int main(){
double lb=0,ub=0,mid;
ll N,x;
cin >> N;
while(N--){
cin >> x;
L.push_back(x);
if(ub<x) ub = x;
}
cin >> K;
do{
mid=(lb+ub)/2;
if(split(mid)) lb=mid;
else ub=mid;
// cout << lb <<" "<< ub <<" "<< mid << endl;
}while(ub-lb>0.0000000001);
printf("%.10lf\n",lb);
return 0;
}
focus