結果
問題 | No.425 ジャンケンの必勝法 |
ユーザー |
![]() |
提出日時 | 2021-01-13 00:58:41 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 256 ms / 2,000 ms |
コード長 | 416 bytes |
コンパイル時間 | 182 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 76,416 KB |
最終ジャッジ日時 | 2024-11-21 14:35:40 |
合計ジャッジ時間 | 5,668 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 18 |
ソースコード
p, q = map(int, input().split())win = 1 / 3def dfs(depth, now, P):global winif depth >= 21:return# 必勝法使うtmp = now * (P/100) * (1/2)win += tmpPnext = max(0, P - q)dfs(depth + 1, tmp, Pnext)# 使わないtmp = now * (1 - P/100) * (1/3)win += tmpPnext = min(100, P + q)dfs(depth + 1, tmp, Pnext)returndfs(0, 1/3, p)print(win)