結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー rogi52rogi52
提出日時 2022-08-18 01:22:02
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 244 ms / 5,000 ms
コード長 610 bytes
コンパイル時間 2,212 ms
コンパイル使用メモリ 198,164 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-26 01:37:09
合計ジャッジ時間 8,761 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 244 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 90 ms
6,940 KB
testcase_03 AC 170 ms
6,940 KB
testcase_04 AC 232 ms
6,940 KB
testcase_05 AC 233 ms
6,940 KB
testcase_06 AC 226 ms
6,944 KB
testcase_07 AC 231 ms
6,940 KB
testcase_08 AC 228 ms
6,940 KB
testcase_09 AC 231 ms
6,940 KB
testcase_10 AC 207 ms
6,940 KB
testcase_11 AC 217 ms
6,944 KB
testcase_12 AC 204 ms
6,944 KB
testcase_13 AC 209 ms
6,940 KB
testcase_14 AC 224 ms
6,940 KB
testcase_15 AC 194 ms
6,944 KB
testcase_16 AC 224 ms
6,940 KB
testcase_17 AC 233 ms
6,940 KB
testcase_18 AC 229 ms
6,944 KB
testcase_19 AC 232 ms
6,940 KB
testcase_20 AC 231 ms
6,940 KB
testcase_21 AC 233 ms
6,944 KB
testcase_22 AC 204 ms
6,940 KB
testcase_23 AC 220 ms
6,940 KB
testcase_24 AC 2 ms
6,944 KB
testcase_25 AC 7 ms
6,940 KB
testcase_26 AC 4 ms
6,940 KB
testcase_27 AC 4 ms
6,944 KB
testcase_28 AC 40 ms
6,940 KB
testcase_29 AC 21 ms
6,944 KB
testcase_30 AC 7 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0