### Red, green, and blue tiles题号：117 难度： 35 中英对照

Using a combination of black square tiles and oblong tiles chosen from: red tiles measuring two units, green tiles measuring three units, and blue tiles measuring four units, it is possible to tile a row measuring five units in length in exactly fifteen different ways.

How many ways can a row measuring fifty units in length be tiled?

NOTE: This is related to Problem 116.

### Code


public final class p117 {
public static void main(String[] args) {
long start=System.nanoTime();
String result = run();
long end=System.nanoTime();
System.out.println(result);
System.out.println( (end-start)/1000000 + "ms" );
}

static public String run(){
final int N=50;
long[] dp=new long[N+1];
dp[0]=1;
for(int i=1;i<=N;i++){
dp[i]=0;
for(int j=1;j<=4&&j<=i;j++){
dp[i]+=dp[i-j];
}
}
return Long.toString(dp[50]);
}

}

100808458960497
0ms