結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 197 ms
5,240 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 171 ms
5,232 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 190 ms
5,160 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 148 ms
4,896 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 161 ms
5,072 KB
testcase_16 AC 170 ms
5,208 KB
testcase_17 AC 171 ms
5,112 KB
testcase_18 AC 170 ms
5,104 KB
testcase_19 AC 190 ms
5,256 KB
testcase_20 AC 190 ms
5,164 KB
testcase_21 AC 192 ms
5,268 KB
testcase_22 AC 155 ms
5,072 KB
testcase_23 AC 162 ms
5,040 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 2 ms
4,380 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, 300)
    {
        double mid = (low + up) / 2;
        if (!ok(mid)) {
            up = mid;
        } else {
            low = mid;
        }
    }
    printf("%.15f\n", up);
}
0