結果

問題 No.2141 Enumeratest
ユーザー とりゐとりゐ
提出日時 2022-12-02 21:47:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 295 ms / 2,000 ms
コード長 439 bytes
コンパイル時間 326 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 138,496 KB
最終ジャッジ日時 2024-04-18 05:38:39
合計ジャッジ時間 10,932 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 263 ms
129,280 KB
testcase_01 AC 243 ms
128,896 KB
testcase_02 AC 244 ms
131,072 KB
testcase_03 AC 221 ms
128,896 KB
testcase_04 AC 244 ms
138,368 KB
testcase_05 AC 242 ms
138,340 KB
testcase_06 AC 242 ms
128,996 KB
testcase_07 AC 225 ms
129,152 KB
testcase_08 AC 244 ms
129,536 KB
testcase_09 AC 230 ms
129,536 KB
testcase_10 AC 255 ms
128,640 KB
testcase_11 AC 235 ms
129,024 KB
testcase_12 AC 242 ms
129,024 KB
testcase_13 AC 232 ms
128,640 KB
testcase_14 AC 265 ms
129,152 KB
testcase_15 AC 237 ms
128,896 KB
testcase_16 AC 291 ms
129,152 KB
testcase_17 AC 284 ms
135,936 KB
testcase_18 AC 274 ms
137,088 KB
testcase_19 AC 295 ms
137,856 KB
testcase_20 AC 274 ms
136,576 KB
testcase_21 AC 255 ms
136,960 KB
testcase_22 AC 234 ms
135,424 KB
testcase_23 AC 263 ms
132,992 KB
testcase_24 AC 235 ms
132,864 KB
testcase_25 AC 236 ms
131,328 KB
testcase_26 AC 237 ms
138,240 KB
testcase_27 AC 239 ms
137,216 KB
testcase_28 AC 260 ms
138,496 KB
testcase_29 AC 239 ms
135,168 KB
testcase_30 AC 230 ms
138,112 KB
testcase_31 AC 244 ms
135,808 KB
testcase_32 AC 233 ms
136,576 KB
testcase_33 AC 237 ms
135,612 KB
testcase_34 AC 247 ms
135,148 KB
testcase_35 AC 236 ms
131,712 KB
testcase_36 AC 284 ms
138,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod=998244353

M=(10**6)*3+1 
fac=[1]*M
ninv=[1]*M
finv=[1]*M
for i in range(2,M):
  fac[i]=fac[i-1]*i%mod
  ninv[i]=(-(mod//i)*ninv[mod%i])%mod
  finv[i]=finv[i-1]*ninv[i]%mod

def binom(n,k):
  if n<0 or k<0:
    return 0
  if k>n:
    return 0
  return (fac[n]*finv[k]%mod)*finv[n-k]%mod

n,m=map(int,input().split())
res=1
a=[m//n]*n
for i in range(m%n):
  a[i]+=1
rem=m
for i in a:
  res*=binom(rem,i)
  res%=mod
  rem-=i

print(res) 
0