結果
問題 | No.67 よくある棒を切る問題 (1) |
ユーザー |
![]() |
提出日時 | 2019-10-23 13:16:15 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 249 ms / 5,000 ms |
コード長 | 891 bytes |
コンパイル時間 | 1,387 ms |
コンパイル使用メモリ | 155,940 KB |
実行使用メモリ | 8,608 KB |
最終ジャッジ日時 | 2025-03-03 11:28:11 |
合計ジャッジ時間 | 7,899 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll=long long; using P=pair<int,int>; #define int long long const int MOD=1e9+7; const int INF=1<<30; const int MAX=1e5; template<class T> inline void xmin(T &a, T b){a=(a<b)?a:b;} template<class T> inline void xmax(T &a, T b){a=(a>b)?a:b;} int n; double l[200000]; double k; bool isOK(double mid, double key){ int sum=0; for(int i=0; i<n; i++){ sum+=l[i]/mid; } if(sum>=key)return true; else return false; } double binary_search(double key){ double ng=10000000000; double ok=0; for(int i=0; i<100; i++){ double mid=(ng+ok)/2; if(isOK(mid, key)) ok=mid; else ng=mid; } return ok; } void solve(){ cin>>n; for(int i=0; i<n; i++){ cin>>l[i]; } cin>>k; printf("%.12f", binary_search(k)); } signed main(){ //while(1) solve(); }