結果
問題 |
No.67 よくある棒を切る問題 (1)
|
ユーザー |
![]() |
提出日時 | 2018-09-14 21:09:57 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 648 bytes |
コンパイル時間 | 594 ms |
コンパイル使用メモリ | 66,772 KB |
実行使用メモリ | 8,608 KB |
最終ジャッジ日時 | 2025-03-03 11:19:36 |
合計ジャッジ時間 | 7,157 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 14 WA * 16 |
ソースコード
#include <iostream> #include <iomanip> #include<math.h> using namespace std; int N,K,i=0; double L[300000]; void nibutan(double s,double t); bool f(double x); int main(){ //double s,t; cin>>N; for(int j=0;j<N;j++){ cin>>L[j]; } cin>>K; nibutan(0.000000001,1000000000); } void nibutan(double s,double t){ double ng = s, ok = t; while (i<100) { double mid = (ng + ok) / 2; (f(mid) ? ok : ng) = mid; // cout<<mid<<endl; i++; } cout<<setprecision(10)<<ok<<endl; } bool f(double x){ int s=0; for(int j=0;j<N;j++){ s+=L[j]/x; } if(K>s)return true; else return false; }