結果

問題 No.2141 Enumeratest
ユーザー mkawa2mkawa2
提出日時 2022-12-02 21:38:37
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 151 ms / 2,000 ms
コード長 1,214 bytes
コンパイル時間 329 ms
コンパイル使用メモリ 86,824 KB
実行使用メモリ 161,016 KB
最終ジャッジ日時 2023-07-31 04:28:40
合計ジャッジ時間 6,979 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
160,272 KB
testcase_01 AC 132 ms
160,028 KB
testcase_02 AC 141 ms
160,164 KB
testcase_03 AC 132 ms
160,140 KB
testcase_04 AC 146 ms
160,252 KB
testcase_05 AC 144 ms
160,184 KB
testcase_06 AC 132 ms
160,220 KB
testcase_07 AC 131 ms
160,000 KB
testcase_08 AC 133 ms
159,908 KB
testcase_09 AC 129 ms
160,164 KB
testcase_10 AC 130 ms
160,220 KB
testcase_11 AC 132 ms
159,984 KB
testcase_12 AC 134 ms
160,008 KB
testcase_13 AC 131 ms
160,156 KB
testcase_14 AC 133 ms
160,316 KB
testcase_15 AC 134 ms
160,544 KB
testcase_16 AC 137 ms
160,132 KB
testcase_17 AC 147 ms
160,416 KB
testcase_18 AC 151 ms
160,352 KB
testcase_19 AC 149 ms
160,540 KB
testcase_20 AC 147 ms
160,120 KB
testcase_21 AC 148 ms
160,532 KB
testcase_22 AC 148 ms
160,340 KB
testcase_23 AC 140 ms
160,484 KB
testcase_24 AC 142 ms
160,560 KB
testcase_25 AC 141 ms
160,580 KB
testcase_26 AC 147 ms
160,356 KB
testcase_27 AC 149 ms
160,432 KB
testcase_28 AC 149 ms
160,352 KB
testcase_29 AC 148 ms
160,488 KB
testcase_30 AC 148 ms
160,520 KB
testcase_31 AC 147 ms
160,192 KB
testcase_32 AC 147 ms
160,560 KB
testcase_33 AC 147 ms
161,016 KB
testcase_34 AC 145 ms
160,332 KB
testcase_35 AC 141 ms
160,352 KB
testcase_36 AC 149 ms
160,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()

# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = (1 << 63)-1
# inf = (1 << 31)-1
# md = 10**9+7
md = 998244353

def nCr(com_n, com_r):
    if com_r < 0: return 0
    if com_n < com_r: return 0
    return fac[com_n]*ifac[com_r]%md*ifac[com_n-com_r]%md

n_max = 1000005
fac = [1]
for i in range(1, n_max+1): fac.append(fac[-1]*i%md)
ifac = [1]*(n_max+1)
ifac[n_max] = pow(fac[n_max], md-2, md)
for i in range(n_max-1, 1, -1): ifac[i] = ifac[i+1]*(i+1)%md

n, m = LI()
p, r = divmod(m, n)

ans = 1
for _ in range(n):
    c = p+(r > 0)
    ans *= nCr(m, c)
    ans %= md
    r -= 1
    m -= c

print(ans)
0