Submit Info #2688

Problem Lang User Status Time Memory
Montmort Number cpp kyoprofriends AC 91 ms 13.80 MiB

ケース詳細
Name Status Time Memory
example_00 AC 1 ms 0.67 MiB
example_01 AC 1 ms 0.67 MiB
max_00 AC 91 ms 13.30 MiB
max_01 AC 84 ms 13.55 MiB
max_02 AC 80 ms 13.80 MiB
random_00 AC 35 ms 5.42 MiB
random_01 AC 41 ms 6.30 MiB
random_02 AC 49 ms 8.05 MiB
random_03 AC 35 ms 6.17 MiB
random_04 AC 67 ms 11.05 MiB

#include<stdio.h> int dp[1000010]; int main(){ int n,mod; scanf("%d%d",&n,&mod); dp[2]=1; for(int i=3;i<=n;i++)dp[i]=(dp[i-1]+dp[i-2])*(i-1LL)%mod; for(int i=1;i<=n;i++)printf("%d ",dp[i]); }