알고리즘
백준 11726번: 2×n 타일링 자바
인지용
2021. 9. 12. 11:30
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class Main {
static int dp[];
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
br.close();
dp = new int[1001];
dp[1] = 1;
dp[2] = 2;
for(int i = 3; i <= n; i++) {
dp[i] = (dp[i-1] + dp[i-2]) % 10007;
}
System.out.print(dp[n]);
}
}