結果
問題 | No.67 よくある棒を切る問題 (1) |
ユーザー |
![]() |
提出日時 | 2015-10-31 21:35:23 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 167 ms / 5,000 ms |
コード長 | 1,275 bytes |
コンパイル時間 | 1,224 ms |
コンパイル使用メモリ | 155,288 KB |
実行使用メモリ | 8,608 KB |
最終ジャッジ日時 | 2025-03-03 10:26:02 |
合計ジャッジ時間 | 5,842 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define lp(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define rep(i, n) lp(i, 0, n) #define rlp(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); i--) #define rrep(i, n) rlp(i, 0, n) #define mp make_pair #define mt make_tuple #define pb push_back #define eb emplace_back #define all(c) begin(c), end(c) typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pr; typedef tuple<int, int, int> tp; template<typename T> inline bool chmin(T &a, T b){ if (a <= b) return false; a = b; return true; } template<typename T> inline bool chmax(T &a, T b){ if (a >= b) return false; a = b; return true; } template<typename T> inline void unique(T &c){ sort(all(c)); c.erase(unique(all(c)), end(c)); } template<typename T> inline T sq(T a){ return a * a; } template<typename T> inline size_t index_of(vector<T> &c, T x){ return lower_bound(all(c), x) - begin(c); } int n; double l[200010]; long long k; bool ok(double x) { long long cnt = 0; rep(i, n) cnt += (long long)(l[i] / x); return cnt >= k; } int main() { cin >> n; rep(i, n) cin >> l[i]; cin >> k; double lb = 0.0, ub = 1e15; rep(i, 200){ double md = (lb + ub) / 2; (ok(md) ? lb : ub) = md; } printf("%.20f\n", lb); }