結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー uenokuuenoku
提出日時 2017-01-08 15:16:13
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 724 bytes
コンパイル時間 723 ms
コンパイル使用メモリ 76,164 KB
実行使用メモリ 5,284 KB
最終ジャッジ日時 2023-08-22 17:38:23
合計ジャッジ時間 5,251 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 138 ms
5,272 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 111 ms
5,112 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 131 ms
5,164 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 96 ms
4,916 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 111 ms
4,896 KB
testcase_16 AC 110 ms
5,208 KB
testcase_17 AC 111 ms
5,264 KB
testcase_18 AC 111 ms
5,212 KB
testcase_19 AC 130 ms
5,112 KB
testcase_20 AC 132 ms
5,116 KB
testcase_21 AC 131 ms
5,284 KB
testcase_22 AC 100 ms
5,112 KB
testcase_23 AC 105 ms
5,008 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 3 ms
4,376 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
using namespace std;
typedef long long int lli;
lli MOD = 1000000007;
int k, n;
double l[200005];
bool ok(double len)
{
    int sum = 0;
    rep(i, n) sum += (int)(l[i] / len);
    return k <= sum;
}
int main()
{
    cin >> n;
    double up = 1e13;
    double low = 0;
    rep(i, n) cin >> l[i];
    cin >> k;
    rep(i, 100)
    {
        double mid = (low + up) / 2;
        if (!ok(mid)) {
            up = mid;
        } else {
            low = mid;
        }
    }
    printf("%.15f\n", up);
}
0