結果

問題 No.453 製薬会社
ユーザー mayoko_mayoko_
提出日時 2016-12-04 00:51:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 713 bytes
コンパイル時間 686 ms
コンパイル使用メモリ 80,004 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-18 12:18:31
合計ジャッジ時間 1,454 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<vector>
#include<string>
#include<cstring>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<cassert>
#include<queue>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

int C, D;
double calc(double a) {
	double b = min((C-3*a/4)*7/2, (D-a/4)*7/5);
	if (b < 0) b = 0;
	return 1000*a + 2000*b;
}

int main() {
	cin >> C >> D;
	double low = 0, high = min(4.*C/3, 4.*D);
	for (int t = 0; t < 100; ++t) {
		const double m1 = (2*low+high)/3;
		const double m2 = (low+2*high)/3;
		if (calc(m1) < calc(m2)) low = m1;
		else high = m2;
	}
	printf("%.10lf\n", calc((low+high)/2));
	return 0;
}
0