結果
問題 |
No.67 よくある棒を切る問題 (1)
|
ユーザー |
![]() |
提出日時 | 2015-03-09 02:18:59 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 560 bytes |
コンパイル時間 | 647 ms |
コンパイル使用メモリ | 60,880 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2025-03-03 10:17:22 |
合計ジャッジ時間 | 14,640 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 8 RE * 22 |
ソースコード
#include <iostream> #include <algorithm> #include <cstdio> using namespace std; typedef long long ll; int N, L[100010]; ll K; bool func(double x) { int cnt=0; for(int i=0;i<N;++i) cnt+=(int)(L[i]/x); return cnt>=K; } int main() { while (cin>>N) { for(int i=0;i<N;++i) cin>>L[i]; cin>>K; double lb=0, ub=1e11; for(int $=0;$<100;++$) { double x=(ub+lb)*0.5; if (func(x)) lb=x; else ub=x; } printf("%.10f\n", lb); } }