結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー focusfocus
提出日時 2018-01-12 15:38:56
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 1,367 ms / 5,000 ms
コード長 627 bytes
コンパイル時間 817 ms
コンパイル使用メモリ 63,248 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-26 00:25:05
合計ジャッジ時間 32,904 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,367 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 505 ms
6,940 KB
testcase_03 AC 977 ms
6,940 KB
testcase_04 AC 1,328 ms
6,940 KB
testcase_05 AC 1,330 ms
6,940 KB
testcase_06 AC 1,330 ms
6,944 KB
testcase_07 AC 1,342 ms
6,940 KB
testcase_08 AC 1,335 ms
6,940 KB
testcase_09 AC 1,344 ms
6,944 KB
testcase_10 AC 1,181 ms
6,940 KB
testcase_11 AC 1,258 ms
6,944 KB
testcase_12 AC 1,152 ms
6,940 KB
testcase_13 AC 1,246 ms
6,940 KB
testcase_14 AC 1,293 ms
6,944 KB
testcase_15 AC 1,171 ms
6,944 KB
testcase_16 AC 1,333 ms
6,944 KB
testcase_17 AC 1,348 ms
6,944 KB
testcase_18 AC 1,342 ms
6,944 KB
testcase_19 AC 1,364 ms
6,940 KB
testcase_20 AC 1,357 ms
6,940 KB
testcase_21 AC 1,361 ms
6,940 KB
testcase_22 AC 1,209 ms
6,940 KB
testcase_23 AC 1,272 ms
6,944 KB
testcase_24 AC 2 ms
6,940 KB
testcase_25 AC 28 ms
6,944 KB
testcase_26 AC 12 ms
6,940 KB
testcase_27 AC 8 ms
6,944 KB
testcase_28 AC 218 ms
6,944 KB
testcase_29 AC 109 ms
6,940 KB
testcase_30 AC 29 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdio>
using namespace std;
typedef long long ll;
ll K;
vector<ll> L;
bool split(double num){
    ll eda=0;
    for(int i=0;i<L.size();i++){
        eda+=L[i]/num;
    }
    if(eda>=K)  return true;
    return false;
}
int main(){
    double lb=0,ub=0,mid;
    ll N,x;
    cin >> N;
    while(N--){
        cin >> x;
        L.push_back(x);
        if(ub<x)    ub = x;
    }
    cin >> K;
    int limit=1000;
    do{
        mid=(lb+ub)/2;
        if(split(mid))    lb=mid;
        else    ub=mid;
    }while(limit--);
    printf("%.10lf\n",lb);
    return 0;
}
0