File tree Expand file tree Collapse file tree 2 files changed +53
-0
lines changed
Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Original file line number Diff line number Diff line change 1+ "use strict" ;
2+
3+ const fs = require ( "fs" ) ;
4+ const input = fs
5+ . readFileSync ( process . platform === "linux" ? "/dev/stdin" : "./input.txt" )
6+ . toString ( )
7+ . trim ( )
8+ . split ( "\n" ) ;
9+
10+ const n = + input [ 0 ] ;
11+
12+ const dp = new Array ( n + 1 ) . fill ( 0 ) ;
13+
14+ dp [ 1 ] = 1 ;
15+ if ( n >= 2 ) dp [ 2 ] = 2 ;
16+
17+ for ( let i = 3 ; i <= n ; i ++ ) {
18+ dp [ i ] = ( dp [ i - 1 ] + dp [ i - 2 ] ) % 10007 ;
19+ }
20+
21+ console . log ( dp [ n ] ) ;
Original file line number Diff line number Diff line change 1+ # [ Silver III] 2×n 타일링 - 11726
2+
3+ [ 문제 링크] ( https://www.acmicpc.net/problem/11726 )
4+
5+ ### 성능 요약
6+
7+ 메모리: 9644 KB, 시간: 148 ms
8+
9+ ### 분류
10+
11+ 다이나믹 프로그래밍
12+
13+ ### 제출 일자
14+
15+ 2026년 3월 1일 15:00:31
16+
17+ ### 문제 설명
18+
19+ <p >2×n 크기의 직사각형을 1×2, 2×1 타일로 채우는 방법의 수를 구하는 프로그램을 작성하시오.</p >
20+
21+ <p >아래 그림은 2×5 크기의 직사각형을 채운 한 가지 방법의 예이다.</p >
22+
23+ <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 >
24+
25+ ### 입력
26+
27+ <p >첫째 줄에 n이 주어진다. (1 ≤ n ≤ 1,000)</p >
28+
29+ ### 출력
30+
31+ <p >첫째 줄에 2×n 크기의 직사각형을 채우는 방법의 수를 10,007로 나눈 나머지를 출력한다.</p >
32+
You can’t perform that action at this time.
0 commit comments