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 |
31 |
Tags
- 알고리즘
- DP
- 티스토리챌린지
- BFS
- stoi
- 오블완
- 백준
- 이분탐색
- 유클리드호제법
- map
- 백트래킹
- N과M
- 배열
- 그래프
- priority_queue
- 프로그래머스
- vector
- int
- 다이나믹프로그래밍
- 분할정복
- Set
- 에라토스테네스의 체
- 깊이우선탐색
- DFS
- 정렬
- C++
- Sort
- 문자열
- 우선순위큐
- 최소공배수
Archives
- Today
- Total
안녕 세상아,
[c++/백준] 11726 2*n 타일링 본문
https://www.acmicpc.net/problem/11726
11726번: 2×n 타일링
2×n 크기의 직사각형을 1×2, 2×1 타일로 채우는 방법의 수를 구하는 프로그램을 작성하시오. 아래 그림은 2×5 크기의 직사각형을 채운 한 가지 방법의 예이다.
www.acmicpc.net
dp 기본 문제.
int 값 범위 넘어가는 것만 신경써주면 쉽게 풀 수 있다.
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long int dp[1001];
dp[1] = 1;
dp[2] = 2;
for (long long int i = 3; i < 1001; i++) {
dp[i] = dp[i - 1]%10007 + dp[i - 2]%10007;
}
long long int n;
cin >> n;
cout << dp[n]%10007;
}
'백준' 카테고리의 다른 글
[c++/백준] 14425 문자열 집합 (0) | 2023.05.11 |
---|---|
[c++/백준] 9375 패션왕 신해빈 (0) | 2023.05.11 |
[c++/백준] 13305 주유소 (0) | 2023.05.10 |
[c++/백준] 15651 N과 M (3) (1) | 2023.05.10 |
[c++/백준] 1021 회전하는 큐 (0) | 2023.05.09 |