Submit Info #10384

Problem Lang User Status Time Memory
Montmort Number python3 convexineq AC 514 ms 59.83 MiB

ケース詳細
Name Status Time Memory
example_00 AC 15 ms 3.99 MiB
example_01 AC 16 ms 3.87 MiB
max_00 AC 514 ms 59.38 MiB
max_01 AC 508 ms 59.57 MiB
max_02 AC 508 ms 59.83 MiB
random_00 AC 214 ms 25.59 MiB
random_01 AC 244 ms 29.56 MiB
random_02 AC 297 ms 36.18 MiB
random_03 AC 234 ms 27.99 MiB
random_04 AC 408 ms 48.72 MiB

""" モンモール数の個数を求めるテーブルを作成 """ def montmort_table(n): res = [0]*(n+1) res[0] = 1 for i in range(2,n+1): res[i] = (i-1)*(res[i-1]+res[i-2])%MOD return res ########################### # https://judge.yosupo.jp/problem/montmort_number_mod # ########################### n,MOD = map(int,input().split()) ans = montmort_table(n) print(*ans[1:])