結果

問題 No.425 ジャンケンの必勝法
ユーザー convexineqconvexineq
提出日時 2021-02-23 06:34:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 54 ms / 2,000 ms
コード長 282 bytes
コンパイル時間 1,180 ms
コンパイル使用メモリ 81,600 KB
実行使用メモリ 75,296 KB
最終ジャッジ日時 2023-10-22 01:54:57
合計ジャッジ時間 2,159 ms
ジャッジサーバーID
(参考情報)
judge9 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,380 KB
testcase_01 AC 37 ms
53,380 KB
testcase_02 AC 40 ms
53,380 KB
testcase_03 AC 54 ms
62,048 KB
testcase_04 AC 51 ms
68,204 KB
testcase_05 AC 48 ms
62,072 KB
testcase_06 AC 47 ms
70,244 KB
testcase_07 AC 47 ms
68,196 KB
testcase_08 AC 49 ms
64,120 KB
testcase_09 AC 49 ms
62,056 KB
testcase_10 AC 34 ms
53,380 KB
testcase_11 AC 41 ms
59,848 KB
testcase_12 AC 46 ms
63,964 KB
testcase_13 AC 54 ms
75,200 KB
testcase_14 AC 43 ms
64,092 KB
testcase_15 AC 41 ms
59,844 KB
testcase_16 AC 43 ms
61,908 KB
testcase_17 AC 42 ms
59,848 KB
testcase_18 AC 36 ms
53,380 KB
testcase_19 AC 39 ms
59,532 KB
testcase_20 AC 42 ms
59,848 KB
testcase_21 AC 53 ms
75,296 KB
testcase_22 AC 52 ms
75,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

p,q = map(lambda x: int(x)/100,input().split())
ans = 1/3
st = [(1/3,p)] #prob, p, used?
while st:
    prob, p = st.pop()
    if prob < 1e-12: continue
    ans += prob*((1.0-p)/3 + p/2)
    st.append((prob*((1.0-p)/3),min(1.0,p+q)))
    st.append((prob*p/2,max(0.0,p-q)))
print(ans)
0