반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- 개발
- 프로그래머스
- Data Engineer
- 코딩
- 용인맛집
- 알고리즘
- 맛집
- BigData
- 코엑스
- 코딩테스트
- hadoop
- 양평
- 백준
- 삼성역맛집
- 코테
- 여행
- Data Engineering
- 파이썬
- BFS
- java
- apache iceberg
- Trino
- bigdata engineering
- 코엑스맛집
- HIVE
- bigdata engineer
- Iceberg
- dfs
- 영어
- 자바
Archives
- Today
- Total
지구정복
[DP] 백준 - 타일 장식물 본문
728x90
반응형
-자바
package dp;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
public class TileDeco {
private static BufferedWriter bw =
new BufferedWriter( new OutputStreamWriter(System.out));
private static int n;
private static long[] d;
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
n = Integer.parseInt( br.readLine() );
d = new long[81];
d[1] = 4;
d[2] = 6;
for( int i=3; i<=n; i++ ) d[i] = d[i-2] + d[i-1];
bw.write( d[n] + "\n" );
bw.flush();
bw.close();
br.close();
}
}
-파이썬
n = int(input())
d = [0] * 81
d[1] = 4
d[2] = 6
for i in range( 3, n+1 ):
d[i] = d[i-2] + d[i-1]
print( d[n] )
728x90
반응형
'데이터 엔지니어링 정복 > Algorithm' 카테고리의 다른 글
[DP] 백준 - 다리놓기 (0) | 2021.07.17 |
---|---|
[DP] 백준 - 파스칼의 삼각형 (0) | 2021.07.16 |
[DP] 백준 - BABBA (1) | 2021.07.16 |
[DP] 백준 - 퇴사2 (0) | 2021.07.16 |
[DP] 백준 - 설탕배달 (0) | 2021.07.15 |
Comments