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
- command not found
- Unreal
- 실습
- Linux
- 2단계로킹
- UnrealMP
- 데이터베이스 배움터
- 민겸수
- hackerank
- oracle
- 의미와 무의미의 경계에서
- objtofbx
- C++
- OS
- 5639
- 1967번
- 1759번
- UActor
- 오손데이터읽기
- 백준 1253번
- Security
- 언리얼 플러그인
- FBX
- 비재귀셰그먼트
- 트랜잭션 관리
- 백준
- SQL
- 1253번
- 셰그먼트트리
- 언리얼 커스텀 플러그인
Archives
- Today
- Total
fatalite
가장 큰 증가하는 부분 수열 - 11055번 백준 본문
문제
문제 난이도 : 실버 2
문제 분류 : DP
문제 리뷰
DP 문제당..
문제 소스 코드
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <unordered_set>
#include <memory.h>
using namespace std;
int DP[1001];
int Arr[1001];
void Init()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
}
int main()
{
Init();
//Input
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> Arr[i];
DP[i] = Arr[i];
}
for (int i = 2; i <= n; i++) {
for (int j = 1; j <= i; j++) {
if (Arr[j] < Arr[i]) {
DP[i] = max(DP[i], DP[j] + Arr[i]);
}
}
}
int Max = 0;
for (int i = 1; i <= n; i++) {
Max < DP[i] ? Max = DP[i] : 0;
}
cout << Max;
}
'코딩 인터뷰 > Dynamic Programming' 카테고리의 다른 글
오르막 수 - 11057번 백준 (0) | 2023.10.14 |
---|---|
카드 구매하기 - 11052번 백준 (0) | 2023.10.13 |
파도반 수열 - 9461번 백준 (1) | 2023.10.13 |
동전 2 - 2294번 백준 (0) | 2023.10.12 |
파이프 옮기기 1 - 17070번 백준 (2) | 2023.09.24 |