結果

問題 No.2141 Enumeratest
ユーザー hir355hir355
提出日時 2022-12-02 21:33:56
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 476 bytes
コンパイル時間 316 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 70,784 KB
最終ジャッジ日時 2024-04-18 05:19:13
合計ジャッジ時間 11,461 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
62,976 KB
testcase_01 AC 43 ms
62,768 KB
testcase_02 AC 81 ms
69,632 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 AC 885 ms
66,048 KB
testcase_06 AC 46 ms
62,464 KB
testcase_07 AC 46 ms
62,848 KB
testcase_08 AC 48 ms
62,976 KB
testcase_09 AC 44 ms
63,104 KB
testcase_10 AC 42 ms
62,720 KB
testcase_11 RE -
testcase_12 AC 47 ms
62,592 KB
testcase_13 AC 46 ms
62,720 KB
testcase_14 RE -
testcase_15 AC 46 ms
62,848 KB
testcase_16 RE -
testcase_17 AC 575 ms
69,760 KB
testcase_18 AC 716 ms
69,888 KB
testcase_19 RE -
testcase_20 AC 629 ms
69,632 KB
testcase_21 AC 703 ms
69,888 KB
testcase_22 AC 525 ms
69,760 KB
testcase_23 AC 278 ms
69,760 KB
testcase_24 RE -
testcase_25 AC 60 ms
69,760 KB
testcase_26 AC 816 ms
69,760 KB
testcase_27 AC 680 ms
70,400 KB
testcase_28 AC 846 ms
69,632 KB
testcase_29 AC 475 ms
69,888 KB
testcase_30 RE -
testcase_31 AC 567 ms
69,760 KB
testcase_32 RE -
testcase_33 AC 531 ms
69,760 KB
testcase_34 RE -
testcase_35 AC 101 ms
69,760 KB
testcase_36 AC 803 ms
69,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353
fac = [1] * (6 * 10 ** 5 + 1)
for i in range(len(fac) - 1):
    fac[i + 1] = fac[i] * (i + 1) % MOD

def comb(n, k):
    if k < 0 or n < k:
        return 0
    return fac[n] * pow(fac[n - k] * fac[k], MOD - 2, MOD) % MOD

n, m = map(int, input().split())
ans = 1
c = 0
for i in range(n):
    if i < m % n:
        ans *= comb(m - c, m // n + 1)
        c += m // n + 1
    else:
        ans *= comb(m - c, m // n)
        c += m // n
    ans %= MOD
print(ans)
0