結果

問題 No.453 製薬会社
ユーザー femtofemto
提出日時 2016-12-06 03:30:47
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 811 bytes
コンパイル時間 1,413 ms
コンパイル使用メモリ 164,368 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-08-18 16:26:09
合計ジャッジ時間 2,695 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double A11 = 3.0 / 4;
const double A12 = 2.0 / 7;
const double A21 = 1.0 / 4;
const double A22 = 5.0 / 7;
double C, D;

const double eps = 1e-10;
bool In(double x1, double x2) {
	if(x1 < 0 || x2 < 0) return false;
	double c = x1 * A11 + x2 * A12;
	double d = x1 * A21 + x2 * A22;
	return 0 <= c && c <= C + eps && 0 <= d && d <= D + eps;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> C >> D;

	double ans = 0;

	ans = max(ans, 1000 * min(C / A11, D / A21));
	ans = max(ans, 2000 * min(C / A12, D / A22));

	double x2 = (A21 * C - A11 * D) / (A12 * A21 - A22 * A11);
	double x1 = (C - A12 * x2) / A11;
	if(In(x1, x2)) {
		ans = max(ans, 1000 * x1 + 2000 * x2);
	}
	cout << fixed << setprecision(15) << ans << endl;
}
0