-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Silver III] Title: 2×n 타일링, Time: 104 ms, Memory: 14352 KB -BaekjoonHub
- Loading branch information
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import java.io.*; | ||
|
||
public class Main { | ||
public static void main(String[] args) throws IOException { | ||
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); | ||
int n = Integer.parseInt(br.readLine()); | ||
int arr[] = new int[n + 2]; | ||
arr[1] = 1; | ||
arr[2] = 2; | ||
for (int i = 3; i <= n; i++) { | ||
arr[i] = (arr[i - 1] + arr[i - 2])%10007; | ||
} | ||
System.out.print(arr[n] % 10007); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# [Silver III] 2×n 타일링 - 11726 | ||
|
||
[문제 링크](https://www.acmicpc.net/problem/11726) | ||
|
||
### 성능 요약 | ||
|
||
메모리: 14352 KB, 시간: 104 ms | ||
|
||
### 분류 | ||
|
||
다이나믹 프로그래밍 | ||
|
||
### 제출 일자 | ||
|
||
2024년 9월 21일 17:17:57 | ||
|
||
### 문제 설명 | ||
|
||
<p>2×n 크기의 직사각형을 1×2, 2×1 타일로 채우는 방법의 수를 구하는 프로그램을 작성하시오.</p> | ||
|
||
<p>아래 그림은 2×5 크기의 직사각형을 채운 한 가지 방법의 예이다.</p> | ||
|
||
<p style="text-align: center;"><img alt="" src="https://onlinejudgeimages.s3-ap-northeast-1.amazonaws.com/problem/11726/1.png" style="height:50px; width:125px"></p> | ||
|
||
### 입력 | ||
|
||
<p>첫째 줄에 n이 주어진다. (1 ≤ n ≤ 1,000)</p> | ||
|
||
### 출력 | ||
|
||
<p>첫째 줄에 2×n 크기의 직사각형을 채우는 방법의 수를 10,007로 나눈 나머지를 출력한다.</p> | ||
|