Problem-solving ideas: First, we define dp [i] i is the number of ways tiled columns, we consider 2 * 2, when a total of three methods, consider 3 * 2, when more out of one, if we erect a direct put a number on the method and time as 2 * 2, or 3, that is, dp [i-1] a number of methods, if we were paving of two 3's, we can only put two and sideways on end a big one, why not put the two on end, because the number of methods of fact and this time in front of overlap, so only add 2 * dp [i-2].
So obtained: dp [i] = (dp [i-1] + 2 * dp [i-2])% 100007;
#include<stdio.h>
int dp[255];
int main(){
int n;
scanf("%d",&n);
dp[0]=1;
dp[1]=1;
for(int i=2;i<=n;i++){
dp[i]=(dp[i-1]+2*dp[i-2])%100007;//及时取模
}
printf("%d\n",dp[n]);
return 0;
}
There is help on the point of a bo praise to hand appreciation is also very wonderful