結果
問題 | No.453 製薬会社 |
ユーザー | pekempey |
提出日時 | 2016-12-04 00:09:12 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 641 bytes |
コンパイル時間 | 1,525 ms |
コンパイル使用メモリ | 165,816 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-27 14:44:41 |
合計ジャッジ時間 | 2,132 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 9 |
ソースコード
#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)); }