結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー GOTKAKO
提出日時 2025-06-29 22:28:53
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 181 ms / 5,000 ms
コード長 518 bytes
コンパイル時間 1,787 ms
コンパイル使用メモリ 196,144 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2025-06-29 22:29:01
合計ジャッジ時間 7,699 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int N; cin >> N;
    vector<double> L(N);
    for(auto &l : L) cin >> l;

    long long K; cin >> K;
    double low = 0,high = 1001001001;
    for(int t=0; t<100; t++){
        double mid = (high+low)/2;
        long long cut = 0;
        for(auto l : L) cut += floor(l/mid);
        if(cut >= K) low = mid;
        else high = mid;
    }
    cout << fixed << setprecision(20) << low << endl;
}
0