結果
| 問題 |
No.425 ジャンケンの必勝法
|
| コンテスト | |
| ユーザー |
tktk_snsn
|
| 提出日時 | 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 / 3
def dfs(depth, now, P):
global win
if depth >= 21:
return
# 必勝法使う
tmp = now * (P/100) * (1/2)
win += tmp
Pnext = max(0, P - q)
dfs(depth + 1, tmp, Pnext)
# 使わない
tmp = now * (1 - P/100) * (1/3)
win += tmp
Pnext = min(100, P + q)
dfs(depth + 1, tmp, Pnext)
return
dfs(0, 1/3, p)
print(win)
tktk_snsn