結果

問題 No.2384 Permutations of Permutations
ユーザー gew1fw
提出日時 2025-06-12 18:00:11
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 373 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 82,248 KB
実行使用メモリ 59,860 KB
最終ジャッジ日時 2025-06-12 18:00:15
合計ジャッジ時間 1,633 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 17 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353

def main():
    import sys
    input = sys.stdin.read
    N, K = map(int, input().split())
    m = N - K
    
    # Precompute factorials up to m
    max_fact = m
    fact = [1] * (max_fact + 1)
    for i in range(1, max_fact + 1):
        fact[i] = fact[i-1] * i % MOD
    
    ans = K * fact[m] % MOD
    print(ans)

if __name__ == "__main__":
    main()
0