-
11727) 2×n 타일링 2 - Java백준코딩일기 2020. 1. 24. 14:34
https://www.acmicpc.net/problem/11727
풀이 )
이 문제를 풀기전에 11726번 문제를 풀어서 조금 쉽게 접근 할 수 있었던 것같다.
11726 문제와는 다르게 2*1 타일 두개를 2*2 타일로 나타낼 수 있어서,
d[n-2] (= 2*1타일을이용한 방법) *2 를 해주었다.1234567891011121314151617181920public class Main {public static void main(String[] args) throws IOException{BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));int n = Integer.parseInt(bf.readLine());int[] d = new int[1001];d[0]=1;d[1]=1;for(int i=2; i<=n; i++) {d[i] = d[i-1] + d[i-2]*2;d[i] %= 10007;}}} cs'백준코딩일기' 카테고리의 다른 글
1929) 소수 구하기 - Java (0) 2020.01.29 2960) 에라토스테네스의 체 - Java (0) 2020.01.29 11726) 2×n 타일링 - Java (0) 2020.01.24 2004) 조합 0의 개수 - Java (0) 2020.01.15 10872) 팩토리얼 - JAVA (0) 2020.01.15