結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー konsin_tokagekonsin_tokage
提出日時 2018-03-30 10:35:06
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 219 ms / 5,000 ms
コード長 434 bytes
コンパイル時間 788 ms
コンパイル使用メモリ 60,748 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-26 00:26:38
合計ジャッジ時間 6,610 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 219 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 82 ms
6,944 KB
testcase_03 AC 153 ms
6,940 KB
testcase_04 AC 189 ms
6,940 KB
testcase_05 AC 189 ms
6,944 KB
testcase_06 AC 188 ms
6,940 KB
testcase_07 AC 213 ms
6,940 KB
testcase_08 AC 212 ms
6,940 KB
testcase_09 AC 212 ms
6,940 KB
testcase_10 AC 170 ms
6,940 KB
testcase_11 AC 180 ms
6,940 KB
testcase_12 AC 164 ms
6,940 KB
testcase_13 AC 194 ms
6,944 KB
testcase_14 AC 201 ms
6,940 KB
testcase_15 AC 180 ms
6,944 KB
testcase_16 AC 188 ms
6,944 KB
testcase_17 AC 190 ms
6,940 KB
testcase_18 AC 188 ms
6,944 KB
testcase_19 AC 211 ms
6,940 KB
testcase_20 AC 211 ms
6,940 KB
testcase_21 AC 212 ms
6,944 KB
testcase_22 AC 170 ms
6,940 KB
testcase_23 AC 179 ms
6,940 KB
testcase_24 AC 2 ms
6,940 KB
testcase_25 AC 6 ms
6,944 KB
testcase_26 AC 3 ms
6,944 KB
testcase_27 AC 3 ms
6,944 KB
testcase_28 AC 35 ms
6,940 KB
testcase_29 AC 18 ms
6,940 KB
testcase_30 AC 6 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <stdio.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<long long> l(n);
    for(auto& i: l) cin >> i;
    long long k;
    cin >> k;
    double d = 0, u = 1e9, m;
    for(int i=0; i<100; ++i){
        m = (d+u)/2;
        long long s = 0;
        for(auto j: l) s += j/m;
        if(s < k) u = m;
        else d = m;
    }
    printf("%.9f\n", m);
    return 0;
}
0