結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー legosukelegosuke
提出日時 2020-02-28 15:37:06
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 59 ms / 5,000 ms
コード長 633 bytes
コンパイル時間 2,117 ms
コンパイル使用メモリ 195,432 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-26 00:58:47
合計ジャッジ時間 4,917 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 23 ms
6,944 KB
testcase_03 AC 41 ms
6,940 KB
testcase_04 AC 53 ms
6,940 KB
testcase_05 AC 53 ms
6,944 KB
testcase_06 AC 53 ms
6,944 KB
testcase_07 AC 58 ms
6,944 KB
testcase_08 AC 59 ms
6,940 KB
testcase_09 AC 57 ms
6,940 KB
testcase_10 AC 48 ms
6,944 KB
testcase_11 AC 51 ms
6,944 KB
testcase_12 AC 47 ms
6,944 KB
testcase_13 AC 53 ms
6,944 KB
testcase_14 AC 55 ms
6,940 KB
testcase_15 AC 49 ms
6,940 KB
testcase_16 AC 52 ms
6,944 KB
testcase_17 AC 52 ms
6,940 KB
testcase_18 AC 53 ms
6,940 KB
testcase_19 AC 58 ms
6,940 KB
testcase_20 AC 57 ms
6,944 KB
testcase_21 AC 57 ms
6,940 KB
testcase_22 AC 49 ms
6,940 KB
testcase_23 AC 51 ms
6,944 KB
testcase_24 AC 2 ms
6,940 KB
testcase_25 AC 3 ms
6,940 KB
testcase_26 AC 2 ms
6,940 KB
testcase_27 AC 2 ms
6,944 KB
testcase_28 AC 11 ms
6,940 KB
testcase_29 AC 6 ms
6,940 KB
testcase_30 AC 3 ms
6,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

int N, K;
int L[200010];

bool check(double x) {
    int num = 0;
    REP (i, N) num += (int)(L[i] / x);
    return (num >= K);
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);

    cin >> N;
    REP (i, N) cin >> L[i];
    cin >> K;
    double ok = 0, ng = 1e9;
    REP (i, 100) {
        double m = (ok + ng) / 2;
        if (check(m)) ok = m;
        else ng = m;
    }
    cout << ok << endl;
}
0