結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー h_nosonh_noson
提出日時 2016-04-29 21:37:24
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 711 bytes
コンパイル時間 484 ms
コンパイル使用メモリ 67,264 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-15 05:28:06
合計ジャッジ時間 6,121 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 62 ms
5,376 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 5 ms
5,376 KB
testcase_26 AC 3 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 26 ms
5,376 KB
testcase_29 AC 14 ms
5,376 KB
testcase_30 AC 5 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;

#define RREP(i,s,e) for (i = s; i >= e; i--)
#define rrep(i,n) RREP(i,n,0)
#define REP(i,s,e) for (i = s; i < e; i++)
#define rep(i,n) REP(i,0,n)
#define INF 100000000

typedef long long ll;

int main() {
    int i, n;
    double l, r;
    ll k;
    int L[100000];
    cin >> n;
    rep (i,n) cin >> L[i];
    cin >> k;
    l = 1e-10; r = 1000000000;
    while (l < r) {
        double m = (l+r) / 2;
        ll sum = 0;
        rep (i,n) sum += L[i]/m;
        if (sum < k)
            r = m-1e-11;
        else
            l = m+1e-11;
    }
    cout << fixed << setprecision(10) << r << endl;
    return 0;
}
0