結果
問題 |
No.67 よくある棒を切る問題 (1)
|
ユーザー |
![]() |
提出日時 | 2018-01-12 15:27:07 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 616 bytes |
コンパイル時間 | 847 ms |
コンパイル使用メモリ | 67,048 KB |
実行使用メモリ | 14,068 KB |
最終ジャッジ日時 | 2025-03-03 11:07:12 |
合計ジャッジ時間 | 10,300 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 WA * 1 TLE * 1 -- * 11 |
ソースコード
#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; }while(ub-lb>0.0000001); printf("%.10lf\n",lb); return 0; }