結果

問題 No.453 製薬会社
ユーザー mayoko_
提出日時 2016-12-04 00:51:38
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 713 bytes
コンパイル時間 1,472 ms
コンパイル使用メモリ 81,836 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-27 17:18:11
合計ジャッジ時間 1,443 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

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