結果
問題 | No.67 よくある棒を切る問題 (1) |
ユーザー |
![]() |
提出日時 | 2016-09-16 03:41:33 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 204 ms / 5,000 ms |
コード長 | 587 bytes |
コンパイル時間 | 801 ms |
コンパイル使用メモリ | 63,032 KB |
実行使用メモリ | 8,608 KB |
最終ジャッジ日時 | 2025-03-03 10:36:27 |
合計ジャッジ時間 | 5,311 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#include <iostream> #include <cstdio> #include <cmath> using namespace std; typedef long long ll; #define rep(i,n) for(int i=0;i<(n);i++) ll n, L[200010]; ll k; bool hantei(double m){ ll sum = 0; rep(i, n){ sum += floor((double)L[i] / m); if(sum >= k) return true; } return false; } int main(void){ cin >> n; rep(i, n) cin >> L[i]; cin >> k; //2分探索 double r = 1e10 + 1, l = 0.0; int cnt = 0; while(r - l > 1e-10 && cnt < 100){ cnt++; double mid = (l + r) / 2.0; if(hantei(mid)){ l = mid; }else{ r = mid; } } printf("%.10f\n", l); return 0; }