문제링크
https://www.acmicpc.net/problem/11726
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
BigInteger d[] = new BigInteger[N+1];
if(N>=1) d[1] = new BigInteger("1");
if(N>=2) d[2] = new BigInteger("2");
for(int i=3;i<=N;i++) {
d[i] = d[i-1].add(d[i-2]);
}
System.out.println(d[N].remainder(new BigInteger("10007")));
}
}
'알고리즘 > 백준' 카테고리의 다른 글
[JAVA]백준_12865_평범한 배낭 (0) | 2021.03.25 |
---|---|
[JAVA]백준_1912_연속합 (0) | 2021.03.24 |
[JAVA]백준_11727_2*N 타일링2 (0) | 2021.03.24 |
[JAVA]백준_9095_1,2,3더하기 (0) | 2021.03.24 |
[JAVA]백준_2748_피보나치수2 (0) | 2021.03.24 |