結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー recososorecososo
提出日時 2020-02-28 18:52:56
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 537 bytes
コンパイル時間 1,681 ms
コンパイル使用メモリ 165,736 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-21 17:39:53
合計ジャッジ時間 33,794 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 303 ms
6,820 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 273 ms
6,940 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 295 ms
6,944 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 238 ms
6,940 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 258 ms
6,940 KB
testcase_16 AC 281 ms
6,940 KB
testcase_17 AC 282 ms
6,944 KB
testcase_18 AC 283 ms
6,944 KB
testcase_19 AC 301 ms
6,944 KB
testcase_20 AC 302 ms
6,940 KB
testcase_21 AC 298 ms
6,940 KB
testcase_22 AC 247 ms
6,944 KB
testcase_23 AC 261 ms
6,944 KB
testcase_24 AC 2 ms
6,940 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
int main(){
    int n;cin >> n;
    vector<ld> a(n);
    ld sum=0;
    for(int i=0;i<n;i++){
        cin >> a[i];
        sum+=a[i];
    }
    ld k;cin >> k;
    ld l=0,r=sum/k;
    for(int i=0;i<100;i++){
        ld mid=(l+r)/2;
        int s=0;
        for(int j=0;j<n;j++){
            s+=floor(a[j]/mid);
        }
        if(s>=k){
            l=mid;
        }
        else{
            r=mid;
        }
    }
    cout << fixed << setprecision(15) << l << endl;
}
0