結果

問題 No.453 製薬会社
ユーザー lam6er
提出日時 2025-03-20 19:02:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 40 ms / 2,000 ms
コード長 854 bytes
コンパイル時間 154 ms
コンパイル使用メモリ 82,884 KB
実行使用メモリ 53,760 KB
最終ジャッジ日時 2025-03-20 19:03:11
合計ジャッジ時間 1,178 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

C, D = map(int, input().split())

# Calculate possible intersection point of the two constraints
numerator_x = 20 * C - 8 * D
x = numerator_x / 13
numerator_y = 7 * (3 * D - C)
y = numerator_y / 13

candidates = []

# Check if the intersection is valid (non-negative)
if x >= 0 and y >= 0:
    # Add the sales from the intersection point
    candidates.append(1000 * x + 2000 * y)

# Calculate maximum sales if only producing product A
x_a = min(4 * C / 3, 4 * D)
candidates.append(1000 * x_a)

# Calculate maximum sales if only producing product B
y_b = min(7 * C / 2, 7 * D / 5)
candidates.append(2000 * y_b)

# Determine the maximum sales from all valid candidates
max_sales = max(candidates)

# Format the output to remove trailing zeros and unnecessary decimal points
formatted = "{0:.12f}".format(max_sales).rstrip('0').rstrip('.')
print(formatted)
0