結果
問題 | No.67 よくある棒を切る問題 (1) |
ユーザー |
|
提出日時 | 2022-08-18 01:22:02 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 249 ms / 5,000 ms |
コード長 | 610 bytes |
コンパイル時間 | 2,088 ms |
コンパイル使用メモリ | 197,068 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2025-03-03 12:01:20 |
合計ジャッジ時間 | 9,120 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(0); int N; cin >> N; using ld = long double; vector<ld> L(N); rep(i,N) cin >> L[i]; ll K; cin >> K; auto f = [&](ld x) { ll cnt = 0; rep(i,N) cnt += floorl(L[i] / x); return K <= cnt; }; ld ok = 0.0, ng = 1e18; int step = 100; rep(_,step) { ld mid = (ok + ng) * 0.5; (f(mid) ? ok : ng) = mid; } cout << fixed << setprecision(20) << ok << endl; }