{{{ #!cplusplus /*经典的错排公式*/ #include __int64 a[21]; void init(){ a[1] = 0; a[2] = 1; a[3] = 2; int i; for(i=4; i< 21; i++){ a[i] = (i-1) * (a[i-1] + a[i-2]); } } int main(){ init(); int n; while(scanf("%d", &n)!=EOF){ printf("%I64d\n", a[n]); } return 0; } }}}