結果

問題 No.453 製薬会社
ユーザー pekempeypekempey
提出日時 2016-12-04 00:09:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 641 bytes
コンパイル時間 1,421 ms
コンパイル使用メモリ 164,584 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-18 10:32:55
合計ジャッジ時間 2,231 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    double C, D;
    cin >> C >> D;
    auto f = [&](double x) {
        double CC = C - x * 3.0 / 4.0;
        double DD = D - x * 1.0 / 4.0;
        double y = min(CC * 7.0 / 2.0, DD * 7.0 / 5.0);
        return 1000 * x + 2000 * y;
    };
    double low = 0;
    double high = min(4.0 / 3.0 * C, 4.0 * D);
    for (int i = 0; i < 200; i++) {
        double mid1 = (low * 2 + high) / 3;
        double mid2 = (low + high * 2) / 3;
        if (f(mid1) < f(mid2)) {
            low = mid1;
        } else {
            high = mid2;
        }
    }
    printf("%.20f\n", f(low));
}
0