Created
July 8, 2015 14:56
-
-
Save mob5566/39072dab25accbf0e7f7 to your computer and use it in GitHub Desktop.
10359 - Tiling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Tittle: 10359 - Tiling | |
* Author: Cheng-Shih, Wong | |
* Date: 2015/07/08 | |
*/ | |
import java.util.*; | |
import java.math.*; | |
public class Main { | |
public static void main( String[] args ) { | |
int n; | |
int N = 300; | |
BigInteger[] dp = new BigInteger[N]; | |
dp[0] = BigInteger.ONE; | |
for( int i=1; i < 300; ++i ) | |
dp[i] = BigInteger.ZERO; | |
Scanner input = new Scanner( System.in ); | |
// init | |
for( int i = 0; i<250; ++i ) { | |
dp[i+1] = dp[i+1].add( dp[i] ); | |
dp[i+2] = dp[i+2].add( dp[i].add(dp[i]) ); | |
} | |
// input | |
while( input.hasNext() ) { | |
n = input.nextInt(); | |
// output | |
System.out.println( dp[n] ); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment