mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
16 lines
259 B
C++
16 lines
259 B
C++
|
#include <stdio.h>
|
||
|
int main()
|
||
|
{
|
||
|
__int64 a[21];
|
||
|
int i,n;
|
||
|
a[1]=0;
|
||
|
a[2]=1;
|
||
|
while(scanf("%d",&n)!=EOF)
|
||
|
{
|
||
|
for(i=3;i<n+1;i++)
|
||
|
{a[i]=(i-1)*(a[i-1]+a[i-2]);}
|
||
|
printf("%I64d\n",a[n]);
|
||
|
}
|
||
|
return 0;
|
||
|
}
|