Skip to content

Commit 0530df1

Browse files
authored
Merge pull request #25 from AlgoLeadMe/7-rivkms
7-rivkms
2 parents d9fc0fc + b046162 commit 0530df1

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

β€Žrivkms/DP/1912.cpp

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include <iostream>
2+
#include <vector>
3+
4+
using namespace std;
5+
6+
int max(int a, int b) {
7+
return a > b ? a : b;
8+
}
9+
int main() {
10+
int m = -2147483647;
11+
int n, tmp;
12+
13+
cin >> n;
14+
vector<int> dp(n);
15+
vector<int> a(n);
16+
for (int i = 0; i < n; i++) {
17+
cin >> a[i];
18+
}
19+
dp[0] = a[0];
20+
for (int i = 0; i < n; i++) {
21+
dp[i] = max(dp[i - 1] + a[i], a[i]);
22+
if (m < dp[i]) m = dp[i];
23+
}
24+
cout << m;
25+
return 0;
26+
}

β€Žrivkms/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
|:----:|:---------:|:----:|:-----:|:----:|
55
| 1μ°¨μ‹œ | 2024.02.12 | DP | [ν‰λ²”ν•œ λ°°λ‚­](https://www.acmicpc.net/problem/12865) | [#1](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/5) |
66
| 2μ°¨μ‹œ | 2024.02.15 | Recursion | [ν•˜λ…Έμ΄ 탑 이동 μˆœμ„œ](https://www.acmicpc.net/problem/11729) | [#2](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/8) |
7-
| 3μ°¨μ‹œ | 2024.02.18 | DP | [ν•˜λ…Έμ΄ 탑 이동 μˆœμ„œ](https://www.acmicpc.net/problem/10844) | [#3](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/11) |
7+
| 3μ°¨μ‹œ | 2024.02.18 | DP | [μ‰¬μš΄ 계단 수](https://www.acmicpc.net/problem/10844) | [#3](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/11) |
88
| 4μ°¨μ‹œ | 2024.02.18 | Backtracking | [N-queen](https://www.acmicpc.net/problem/9663) | [#4](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/13) |
99
| 5μ°¨μ‹œ | 2024.02.24 | Backtracking | [μž…λŒ€](https://www.acmicpc.net/problem/31413) | [#5](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/18) |
1010
| 6μ°¨μ‹œ | 2024.02.27 | BFS | [ν† λ§ˆν† ](https://www.acmicpc.net/problem/7576) | [#6](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/20) |
11+
| 7μ°¨μ‹œ | 2024.03.01 | DP | [연속합](https://www.acmicpc.net/problem/1912) | [#7](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/25) |
1112
---

0 commit comments

Comments
Β (0)