結果
問題 | No.1923 Divisor Array |
ユーザー |
![]() |
提出日時 | 2022-05-02 18:01:58 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 281 ms / 2,000 ms |
コード長 | 899 bytes |
コンパイル時間 | 190 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 77,696 KB |
最終ジャッジ日時 | 2024-07-01 21:59:36 |
合計ジャッジ時間 | 7,893 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 51 |
ソースコード
MOD = 998244353 N, M, K = map(int, input().split()) f = [0] * (M + 1) f[1] = 1 cnt = [0] * (M + 1) cnt[1] = 1 binom = 1 for m in range(1, M): binom *= N - m + 1 binom *= pow(m, MOD - 2, MOD) binom %= MOD cnt.pop() cnt.insert(0, 0) for i in range(M - (M % 2 == 0), 0, -2): cnt[i] -= cnt[i + 1 >> 1] if cnt[i] < 0: cnt[i] += MOD for i in range(1, M + 1): cnt[i] += cnt[i - 1] if cnt[i] >= MOD: cnt[i] -= MOD f[i] += cnt[i] * binom for i in range(M + 1): f[i] %= MOD def mul(a, b): c = [0] * (M + 1) for i in range(1, M + 1): for j in range(1, M // i + 1): c[i * j] += a[i] * b[j] for i in range(M + 1): c[i] %= MOD return c ans = [0] * (M + 1) ans[1] = 1 while K: if K & 1: ans = mul(ans, f) K >>= 1 f = mul(f, f) print(sum(ans) % MOD)