結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー rokahikou1rokahikou1
提出日時 2019-09-08 20:02:27
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 211 ms / 5,000 ms
コード長 776 bytes
コンパイル時間 983 ms
コンパイル使用メモリ 83,344 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-26 00:45:40
合計ジャッジ時間 6,706 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 210 ms
6,816 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 78 ms
6,940 KB
testcase_03 AC 149 ms
6,940 KB
testcase_04 AC 185 ms
6,940 KB
testcase_05 AC 186 ms
6,940 KB
testcase_06 AC 181 ms
6,940 KB
testcase_07 AC 204 ms
6,940 KB
testcase_08 AC 204 ms
6,944 KB
testcase_09 AC 205 ms
6,944 KB
testcase_10 AC 167 ms
6,944 KB
testcase_11 AC 178 ms
6,940 KB
testcase_12 AC 162 ms
6,940 KB
testcase_13 AC 193 ms
6,944 KB
testcase_14 AC 199 ms
6,944 KB
testcase_15 AC 179 ms
6,940 KB
testcase_16 AC 188 ms
6,940 KB
testcase_17 AC 186 ms
6,944 KB
testcase_18 AC 182 ms
6,944 KB
testcase_19 AC 211 ms
6,940 KB
testcase_20 AC 205 ms
6,944 KB
testcase_21 AC 204 ms
6,940 KB
testcase_22 AC 166 ms
6,940 KB
testcase_23 AC 172 ms
6,940 KB
testcase_24 AC 2 ms
6,940 KB
testcase_25 AC 6 ms
6,944 KB
testcase_26 AC 3 ms
6,940 KB
testcase_27 AC 2 ms
6,940 KB
testcase_28 AC 34 ms
6,940 KB
testcase_29 AC 17 ms
6,940 KB
testcase_30 AC 6 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

ll calc(double v,vector<ll> &l){
    ll ret = 0;
    rep(i,l.size()){
        ret+=l[i]/v;
    }
    return ret;
}

int main(){
    ll N;cin >> N;
    vector<ll> L(N);
    rep(i,N)cin >> L[i];
    ll K;cin >> K;
    double l=0,r=1e11;
    double m;
    rep(i,100){
        m=(l+r)/2;
        if(calc(m,L)>=K)l=m;
        else r=m;
    }
    cout << fixed << setprecision(12) << m << endl;
    return 0;
}
0