結果
問題 |
No.67 よくある棒を切る問題 (1)
|
ユーザー |
![]() |
提出日時 | 2015-10-01 00:23:27 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 832 bytes |
コンパイル時間 | 1,485 ms |
コンパイル使用メモリ | 157,776 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2025-03-03 10:25:00 |
合計ジャッジ時間 | 4,407 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 WA * 29 |
ソースコード
#include "bits/stdc++.h" using namespace std; #define REP(i, n) for(int i=0; i<(n); i++) #define int long long #define ALL(a) (a).begin(),(a).end() #define SUM(a) accumulate(ALL(a), 0) #define FOR(i, a, b) for(int i=(a);i<(b);i++) int N, K; vector<int> L(222222); int count(double n) { int cnt = 0; REP(j,N) { cnt += (int)(L[j] / n); } return cnt; } signed main() { cin >> N; REP(i,N) cin >> L[i]; cin >> K; double maxl = 1.0 * SUM(L) / K; if (K <= N) { cout << L[K-1] << endl; return 0; } double high = maxl; double low = 0.0; REP(i,100) { double l = (high + low) / 2.0; int cnt = count(l); if (cnt >= K) { low = l; } else { high = l; } } printf("%.14f\n", (high + low) / 2.0); }