結果

問題 No.1230 Hall_and_me
ユーザー tobusakanatobusakana
提出日時 2022-11-05 15:56:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 72 ms / 2,000 ms
コード長 1,008 bytes
コンパイル時間 376 ms
コンパイル使用メモリ 86,768 KB
実行使用メモリ 71,628 KB
最終ジャッジ日時 2023-09-26 14:32:49
合計ジャッジ時間 5,845 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,072 KB
testcase_01 AC 68 ms
71,628 KB
testcase_02 AC 69 ms
71,572 KB
testcase_03 AC 68 ms
71,388 KB
testcase_04 AC 70 ms
71,316 KB
testcase_05 AC 69 ms
71,112 KB
testcase_06 AC 69 ms
71,504 KB
testcase_07 AC 69 ms
71,180 KB
testcase_08 AC 70 ms
71,096 KB
testcase_09 AC 71 ms
71,464 KB
testcase_10 AC 69 ms
71,456 KB
testcase_11 AC 71 ms
71,300 KB
testcase_12 AC 69 ms
71,596 KB
testcase_13 AC 70 ms
71,464 KB
testcase_14 AC 70 ms
71,352 KB
testcase_15 AC 72 ms
71,520 KB
testcase_16 AC 68 ms
71,304 KB
testcase_17 AC 68 ms
71,176 KB
testcase_18 AC 69 ms
71,240 KB
testcase_19 AC 70 ms
71,148 KB
testcase_20 AC 68 ms
71,280 KB
testcase_21 AC 70 ms
71,416 KB
testcase_22 AC 68 ms
71,392 KB
testcase_23 AC 70 ms
71,388 KB
testcase_24 AC 67 ms
71,148 KB
testcase_25 AC 70 ms
71,276 KB
testcase_26 AC 68 ms
71,244 KB
testcase_27 AC 68 ms
71,032 KB
testcase_28 AC 70 ms
71,476 KB
testcase_29 AC 68 ms
71,096 KB
testcase_30 AC 69 ms
71,404 KB
testcase_31 AC 68 ms
71,468 KB
testcase_32 AC 69 ms
71,092 KB
testcase_33 AC 69 ms
71,356 KB
testcase_34 AC 68 ms
71,452 KB
testcase_35 AC 70 ms
71,348 KB
testcase_36 AC 67 ms
71,524 KB
testcase_37 AC 70 ms
71,100 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0