結果
問題 | No.66 輝け☆全国たこやき杯 |
ユーザー | 👑 rin204 |
提出日時 | 2022-09-29 19:18:44 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 88 ms / 5,000 ms |
コード長 | 538 bytes |
コンパイル時間 | 430 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 71,296 KB |
最終ジャッジ日時 | 2024-12-22 18:18:13 |
合計ジャッジ時間 | 1,480 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
m = int(input()) S = [float(input()) for _ in range(1 << m)] def P(i, j): a = S[i] ** 2 b = S[j] ** 2 return a / (a + b) dp = [1.0] * (1 << m) for i in range(m): ndp = [0.0] * (1 << m) x = 0 d = 1 << i while x < (1 << m): L = list(range(x, x + d)) x += d R = list(range(x, x + d)) x += d for l in L: for r in R: ndp[l] += dp[l] * dp[r] * P(l, r) ndp[r] += dp[l] * dp[r] * P(r, l) dp = ndp print(dp[0])