結果
問題 |
No.67 よくある棒を切る問題 (1)
|
ユーザー |
![]() |
提出日時 | 2015-08-06 00:34:29 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 479 bytes |
コンパイル時間 | 1,193 ms |
コンパイル使用メモリ | 157,836 KB |
実行使用メモリ | 12,960 KB |
最終ジャッジ日時 | 2025-03-03 10:22:27 |
合計ジャッジ時間 | 10,294 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 16 TLE * 1 -- * 13 |
ソースコード
#include <bits/stdc++.h> using namespace std; vector<int> l(200000); int n; long long int k; bool check(double u){ if(u==0) return true; long long int cnt=0; for(int i=0;i<n;i++){ cnt+=l[i]/u; } if(cnt>=k) return true; else return false; } int main(){ cin>>n; for(int i=0;i<n;i++) cin>>l[i]; cin>>k; double l=0,r=1000000000; while(r-l>1e-9){ if(check((l+r)/2)) l=(l+r)/2; else r=(l+r)/2; cout<<l<<" "<<r<<endl; } printf("%.15lf\n",(l+r)/2); return 0; }