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
- 민겸수
- 백준 1253번
- OS
- 셰그먼트트리
- FBX
- 언리얼 커스텀 플러그인
- SQL
- 의미와 무의미의 경계에서
- 데이터베이스 배움터
- UnrealMP
- 1759번
- 트랜잭션 관리
- command not found
- 5639
- 백준
- Security
- 1253번
- C++
- Unreal
- 실습
- oracle
- objtofbx
- Linux
- 2단계로킹
- 1967번
- 오손데이터읽기
- hackerank
- 언리얼 플러그인
- UActor
- 비재귀셰그먼트
Archives
- Today
- Total
fatalite
🏳 쉬운 계단 수 / 10844번 백준 본문
문제
문제 난이도 : 실버 1
문제 분류 : 다이나믹 프로그래밍, 모듈러 연산 성질
문제 풀이
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
int main()
{
//Input
int n = -1;
cin >> n;
vector<vector<long long int>> DP(n+1, vector<long long int>(12, 0)); // (Padding) 0 ~ 9 (Padding)
//Main Logic
DP[1][1] = 0;
for (int i = 2; i < 11; i++)
{
DP[1][i] = 1;
}
for (int i = 2; i <= n; i++)
{
for (int j = 1; j < 11; j++)
{
DP[i][j] = DP[i - 1][j - 1] + DP[i - 1][j + 1];
DP[i][j] %= 1000000000;
}
}
//Output
long long int Result = 0;
for (int i = 1; i <= 11; i++)
{
Result += DP[n][i];
Result %= 1000000000;
}
cout << Result;
}
참조
'코딩 인터뷰 > C++' 카테고리의 다른 글
섬의 개수 - 4963번 백준 (0) | 2023.09.16 |
---|---|
점프 점프 - 11060번 백준 (0) | 2023.09.14 |
연속합 / 1912번 백준 (0) | 2023.09.09 |
암호 만들기 / 1759번 백준 (0) | 2023.09.04 |
치킨 배달 / 15686번 백준 (4) | 2023.09.03 |