結果
| 問題 |
No.1230 Hall_and_me
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-11-05 15:56:39 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 42 ms / 2,000 ms |
| コード長 | 1,008 bytes |
| コンパイル時間 | 144 ms |
| コンパイル使用メモリ | 82,164 KB |
| 実行使用メモリ | 53,772 KB |
| 最終ジャッジ日時 | 2024-07-19 08:45:02 |
| 合計ジャッジ時間 | 2,746 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 36 |
ソースコード
rate = list(map(int,input().split()))
M = sum(rate) # 分母
# P,Q,Rのどれを選ぶか、STAYかCHANGEか
# の3 * 2 = 6通りを全探索し、最も確率の高いものを選ぶ
def f(choice, method):
# 宝がP,Q,Rのそれぞれだった場合の確率を求める。
res = 0
for real in range(3):
r = rate[real] / M # 宝が0-2に入っている確率
# choiceと一致していて、CHANGEの場合は、確率0
if choice == real and method == "CHANGE":
continue
# choiceと一致しておらず、STAYの場合は、確率0
if choice != real and method == "STAY":
continue
# choiceと一致していて、STAYの場合
if choice == real and method == "STAY":
res += r
# choiceと一致しておらず、CHANGEの場合
if choice != real and method == "CHANGE":
res += r
return res
ans = 0
for choice in range(3):
for method in ("STAY","CHANGE"):
val = f(choice, method)
if ans < val:
ans = val
print(ans)