結果

問題 No.425 ジャンケンの必勝法
ユーザー roiti46
提出日時 2016-10-10 21:50:38
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 446 bytes
コンパイル時間 105 ms
コンパイル使用メモリ 6,948 KB
実行使用メモリ 8,960 KB
最終ジャッジ日時 2024-11-22 01:10:11
合計ジャッジ時間 1,933 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 15 WA * 3
権限があれば一括ダウンロードができます

ソースコード

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