結果
| 問題 |
No.2872 Depth of the Parentheses
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2024-09-08 03:43:28 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 49 ms / 2,000 ms |
| コード長 | 630 bytes |
| コンパイル時間 | 451 ms |
| コンパイル使用メモリ | 82,424 KB |
| 実行使用メモリ | 61,388 KB |
| 最終ジャッジ日時 | 2024-09-08 03:43:43 |
| 合計ジャッジ時間 | 9,877 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 MLE * 5 |
ソースコード
import sys
input = sys.stdin.readline
x,K=map(int,input().split())
mod=998244353
PLUS=x*pow(100,mod-2,mod)%mod
MINUS=(100-x)*pow(100,mod-2,mod)%mod
DP=[[0]*(2*K+3) for i in range(2*K+3)]
DP[0][0]=1
for tests in range(2*K):
NDP=[[0]*(2*K+3) for i in range(2*K+3)]
for i in range(2*K+3):
for j in range(2*K+3):
now=DP[i][j]
if now==0:
continue
NDP[i+1][max(j,i+1)]+=DP[i][j]*PLUS%mod
if i-1>=0:
NDP[i-1][j]+=DP[i][j]*MINUS%mod
DP=NDP
ANS=0
for i in range(2*K+3):
ANS+=DP[0][i]*i
ANS%=mod
print(ANS)
titia