結果
問題 |
No.67 よくある棒を切る問題 (1)
|
ユーザー |
|
提出日時 | 2015-02-15 02:17:44 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 593 bytes |
コンパイル時間 | 742 ms |
コンパイル使用メモリ | 66,072 KB |
実行使用メモリ | 8,480 KB |
最終ジャッジ日時 | 2025-03-03 10:15:04 |
合計ジャッジ時間 | 10,414 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 TLE * 1 -- * 13 |
ソースコード
#include <iostream> #include <cstdio> #include <vector> #include <algorithm> #include <utility> const double EPS = 1e-9; using namespace std; int main() { int n; long long k; cin >> n; vector<double> l(n, 0); for (int i = 0; i < n; i++) { cin >> l[i]; } cin >> k; double upper = 1e9; double lower = 0; double mid; long long count; while (upper - lower > EPS) { mid = (upper + lower) / 2; count = 0; for (int i = 0; i < n; i++) { count += l[i] / mid; } if (count >= k) { lower = mid; } else { upper = mid; } } printf("%.10f\n", mid); return 0; }