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