結果
問題 | No.2130 分配方法の数え上げ mod 998244353 |
ユーザー |
![]() |
提出日時 | 2025-03-20 21:08:42 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 130 ms / 2,000 ms |
コード長 | 615 bytes |
コンパイル時間 | 152 ms |
コンパイル使用メモリ | 82,356 KB |
実行使用メモリ | 60,168 KB |
最終ジャッジ日時 | 2025-03-20 21:09:31 |
合計ジャッジ時間 | 3,200 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 38 |
ソースコード
import sysMOD = 998244353def main():N = int(sys.stdin.readline())M = int(sys.stdin.readline())if M > N:print(0)returnmod = MODb = N % modt = min(M-1, b)sum_c = 0current = 1 # C(b, 0)sum_c = current % modfor k in range(1, t + 1):current = current * (b - k + 1) % modcurrent = current * pow(k, mod-2, mod) % modsum_c = (sum_c + current) % modpow_2n = pow(2, N, mod)ans = (pow_2n - sum_c) % modif ans < 0:ans += modprint(ans)if __name__ == "__main__":main()