結果

問題 No.2058 Binary String
ユーザー titiatitia
提出日時 2022-08-29 04:34:45
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 804 ms / 2,000 ms
コード長 444 bytes
コンパイル時間 75 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 34,432 KB
最終ジャッジ日時 2024-04-23 22:21:38
合計ジャッジ時間 13,240 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 203 ms
34,304 KB
testcase_01 AC 200 ms
34,432 KB
testcase_02 AC 396 ms
34,432 KB
testcase_03 AC 201 ms
34,304 KB
testcase_04 AC 200 ms
34,176 KB
testcase_05 AC 203 ms
34,304 KB
testcase_06 AC 231 ms
34,304 KB
testcase_07 AC 716 ms
34,176 KB
testcase_08 AC 301 ms
34,304 KB
testcase_09 AC 770 ms
34,304 KB
testcase_10 AC 409 ms
34,304 KB
testcase_11 AC 315 ms
34,304 KB
testcase_12 AC 495 ms
34,304 KB
testcase_13 AC 431 ms
34,304 KB
testcase_14 AC 367 ms
34,432 KB
testcase_15 AC 366 ms
34,176 KB
testcase_16 AC 371 ms
34,176 KB
testcase_17 AC 422 ms
34,304 KB
testcase_18 AC 214 ms
34,176 KB
testcase_19 AC 753 ms
34,304 KB
testcase_20 AC 668 ms
34,304 KB
testcase_21 AC 751 ms
34,304 KB
testcase_22 AC 726 ms
34,432 KB
testcase_23 AC 799 ms
34,304 KB
testcase_24 AC 748 ms
34,304 KB
testcase_25 AC 804 ms
34,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod=998244353

N,K=map(int,input().split())

FACT=[1]
for i in range(1,3*10**5+1):
    FACT.append(FACT[-1]*i%mod)

FACT_INV=[pow(FACT[-1],mod-2,mod)]
for i in range(3*10**5,0,-1):
    FACT_INV.append(FACT_INV[-1]*i%mod)

FACT_INV.reverse()

def Combi(a,b):
    if 0<=b<=a:
        return FACT[a]*FACT_INV[b]%mod*FACT_INV[a-b]%mod
    else:
        return 0

ANS=0

for i in range(N):
    ANS+=Combi(N-1,i)*pow(i,K,mod)
    ANS%=mod

print(ANS)
0