🐣 알고리즘 삐약/💻 백준 삐약

74 삐약 : 백준 11726| 2xn 타일링 [바킹독 문제 풀이|DP|JAVA]

우주수첩 2024. 6. 16. 17:04
728x90

https://www.acmicpc.net/problem/11726

 

 

package BKD_0x10_DP;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class BOJ_11726 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int n = Integer.parseInt(br.readLine());

        int[] 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.println(dp[n]);

    }
}

 

이제 얼추 어케 하는지 알게따!!! 꺄핳

728x90