結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー Irmystp
提出日時 2014-12-04 23:21:57
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 668 bytes
コンパイル時間 813 ms
コンパイル使用メモリ 64,600 KB
実行使用メモリ 8,608 KB
最終ジャッジ日時 2025-03-03 10:13:19
合計ジャッジ時間 41,786 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1 WA * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>
using namespace std;

const int MAX_N = 200000;

int N, K;
long double L[MAX_N];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    for(int x = 0; x < N; x++){
        cin >> L[x];
    }
    cin >> K;
    long double left = 0, right = 1000000000;
    for(int n = 0; n < 150; n++){
        double mid = (left + right)/2;
        int cnt = 0;
        for(int i = 0; i < N; i++){
            cnt += floor(L[i] / mid);
        }
        if(cnt >= K){
            left = mid;
        }else{
            right = mid;
        }
    }
    cout << left << endl;
    return 0;
}
0