結果

問題 No.2141 Enumeratest
ユーザー kawa-yo
提出日時 2022-12-04 16:41:02
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 458 bytes
コンパイル時間 120 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-10-11 19:28:27
合計ジャッジ時間 15,970 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 23 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353

def comb(n, m):
    if m > n - m:
        return comb(n, n - m)

    out = 1
    for i in range(m):
        out *= n-i
        out //= i + 1
        out %= mod
    return out

n, m = map(int, input().split(" "))

avg = m // n
res = m % n

ans = 1
cnt = 0
for i in range(n - res):
    ans *= comb(m - cnt, avg)
    ans %= mod
    cnt += avg
for i in range(n-res, n):
    ans *= comb(m - cnt, avg+1)
    ans %= mod
    cnt += avg+1

print(ans)
0