結果

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

ソースコード

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-12: que.append([ak*pk*1.0/2, max(0, pk - q)])
    if ak*1.0/3 > 1e-12: que.append([ak*(1 - pk)*1.0/3, min(1, pk + q)])
print "%.10f" % ans
0