結果

問題 No.2141 Enumeratest
ユーザー sepa38sepa38
提出日時 2022-12-02 21:36:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 931 ms / 2,000 ms
コード長 512 bytes
コンパイル時間 241 ms
コンパイル使用メモリ 82,312 KB
実行使用メモリ 91,520 KB
最終ジャッジ日時 2024-04-18 05:23:03
合計ジャッジ時間 35,685 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 894 ms
73,600 KB
testcase_01 AC 895 ms
74,112 KB
testcase_02 AC 908 ms
80,512 KB
testcase_03 AC 894 ms
73,984 KB
testcase_04 AC 913 ms
75,520 KB
testcase_05 AC 903 ms
75,520 KB
testcase_06 AC 896 ms
73,728 KB
testcase_07 AC 895 ms
74,368 KB
testcase_08 AC 895 ms
74,240 KB
testcase_09 AC 899 ms
74,240 KB
testcase_10 AC 897 ms
73,984 KB
testcase_11 AC 897 ms
74,128 KB
testcase_12 AC 895 ms
73,472 KB
testcase_13 AC 894 ms
73,472 KB
testcase_14 AC 896 ms
73,856 KB
testcase_15 AC 894 ms
74,496 KB
testcase_16 AC 894 ms
74,112 KB
testcase_17 AC 911 ms
77,184 KB
testcase_18 AC 914 ms
77,184 KB
testcase_19 AC 911 ms
77,184 KB
testcase_20 AC 910 ms
77,312 KB
testcase_21 AC 919 ms
77,312 KB
testcase_22 AC 910 ms
77,312 KB
testcase_23 AC 906 ms
77,184 KB
testcase_24 AC 924 ms
91,264 KB
testcase_25 AC 901 ms
78,080 KB
testcase_26 AC 914 ms
77,184 KB
testcase_27 AC 911 ms
77,184 KB
testcase_28 AC 918 ms
77,184 KB
testcase_29 AC 907 ms
77,440 KB
testcase_30 AC 912 ms
77,312 KB
testcase_31 AC 917 ms
77,184 KB
testcase_32 AC 910 ms
77,440 KB
testcase_33 AC 911 ms
77,184 KB
testcase_34 AC 931 ms
91,520 KB
testcase_35 AC 901 ms
77,312 KB
testcase_36 AC 915 ms
77,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def cominit(n, mod):
  global fac, finv
  fac = [1] * n
  finv = [1] * n
  for i in range(2, n):
    fac[i] = (fac[i-1] * i) % mod
    finv[i] = (finv[i-1] * pow(i, mod-2, mod)) % mod

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

mod = 998244353

cominit(10**6+10, mod)


n, m = map(int, input().split())
ans = 1
k = m
for i in range(n-1):
  ans *= comb(k, m//n+(m%n>i))
  ans %= mod
  k -= m // n + (m % n > i)
print(ans)
0