There is obviously no effect on the answer.
So let's move the obstacles to the main diagonal. Then there's the wrong line.
F[i]= (F[i-1]+f[i-2]) * (i-1)
1#include <cstdio>2#include <iostream>3#include <cstring>4#include <algorithm>5 #definell Long Long6 using namespacestd;7 Const intModd=10000;8 intd[2333],c[2333],b[2333],a[2333];9 inti,j,k,n,m;Ten One intRaCharRx; AInlineintRead () { -Rx=getchar (), ra=0; - while(rx<'0'|| Rx>'9') rx=GetChar (); the while(rx>='0'&&rx<='9') ra*=Ten, ra+=rx- -, Rx=getchar ();returnRA; - } -InlinevoidAddtoc () { - intLen=max (a[0],b[0]), I; +Memset (c,0, (c[0]+1) <<2); - for(i=1; i<=len;i++){ +c[i]+=a[i]+B[i]; A if(c[i]>=modd) c[i]-=modd,c[i+1]++; at } - if(c[len+1]) len++;c[0]=Len; - } -InlinevoidMultoc (intx) { - inti,len=c[0]; - for(i=1; i<=len;i++){ ind[i]+=c[i]*x; - if(d[i]>=modd) d[i+1]+=d[i]/modd,d[i]%=modd; to } + if(d[len+1]) len++; -memcpy (C,d, (len+1) <<2), c[0]=Len, thememset (D,0, (len+1) <<2); * } $ intMain () {Panax Notoginsengn=read (); -a[0]=b[0]=1, a[1]=1, b[1]=0; the for(i=2; i<=n;i++){ +Addtoc (), Multoc (i-1); Amemcpy (A +1, B +1, Max (a[0],b[0]) <<2), a[0]=b[0], thememcpy (b +1, c+1, Max (b[0],c[0]) <<2), b[0]=c[0]; + } -printf"%d", b[b[0]]); $ for(i=b[0]-1; i;i--) printf ("%04d", B[i]);p UTS (""); $}
View Code
[bzoj4563] [Haoi2016] Put a pawn