結果

問題 No.425 ジャンケンの必勝法
ユーザー roiti46roiti46
提出日時 2016-10-10 21:50:38
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 446 bytes
コンパイル時間 152 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 8,832 KB
最終ジャッジ日時 2024-05-01 19:05:13
合計ジャッジ時間 1,747 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
8,276 KB
testcase_01 AC 24 ms
8,192 KB
testcase_02 AC 23 ms
8,192 KB
testcase_03 AC 25 ms
8,192 KB
testcase_04 AC 30 ms
8,320 KB
testcase_05 AC 26 ms
8,192 KB
testcase_06 AC 34 ms
8,448 KB
testcase_07 AC 29 ms
8,320 KB
testcase_08 AC 27 ms
8,320 KB
testcase_09 AC 25 ms
8,192 KB
testcase_10 AC 24 ms
8,320 KB
testcase_11 AC 27 ms
8,192 KB
testcase_12 AC 27 ms
8,192 KB
testcase_13 WA -
testcase_14 AC 28 ms
8,192 KB
testcase_15 AC 24 ms
8,192 KB
testcase_16 AC 27 ms
8,320 KB
testcase_17 AC 26 ms
8,192 KB
testcase_18 AC 24 ms
8,192 KB
testcase_19 AC 25 ms
8,192 KB
testcase_20 AC 26 ms
8,192 KB
testcase_21 WA -
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-
import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll

p, q = map(int, raw_input().split())
p, q = p/100.0, q/100.0

ans = 1.0/3
que = [[1.0/3, p]]
while que:
    ak, pk = que.pop(0)
    ans += ak*pk*1.0/2
    ans += ak*(1 - pk)*1.0/3
    if ak*1.0/2 > 1e-9: que.append([ak*pk*1.0/2, max(0, pk - q)])
    if ak*1.0/3 > 1e-9: que.append([ak*(1 - pk)*1.0/3, min(1, pk + q)])
print "%.10f" % ans
0