結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー konsin_tokage
提出日時 2018-03-30 10:35:06
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 245 ms / 5,000 ms
コード長 434 bytes
コンパイル時間 494 ms
コンパイル使用メモリ 62,508 KB
実行使用メモリ 8,608 KB
最終ジャッジ日時 2025-03-03 11:10:31
合計ジャッジ時間 6,583 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

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