結果

問題 No.2872 Depth of the Parentheses
ユーザー flippergo
提出日時 2025-05-04 10:50:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 116 ms / 2,000 ms
コード長 459 bytes
コンパイル時間 678 ms
コンパイル使用メモリ 82,148 KB
実行使用メモリ 76,228 KB
最終ジャッジ日時 2025-05-04 10:50:12
合計ジャッジ時間 6,205 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
外部呼び出し有り
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 TLE * 1 -- * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353
x,K = map(int,input().split())
ans = 0
for s in range(2**(2*K)):
    flag = True
    cmin = 100
    cnt = 0
    for i in range(2*K):
        if s>>i & 1:
            cnt -= 1
        else:
            cnt += 1
        if cnt>0:
            flag = False
            break
        cmin = min(cmin,cnt)
    if cnt==0 and flag:
        ans += -cmin
rev = pow(100,MOD-2,MOD)
ans = (ans*pow(x,K,MOD)*pow(100-x,K,MOD)*pow(rev,2*K,MOD))%MOD
print(ans)
0