Commit cd332ae 1 parent a5f698b commit cd332ae Copy full SHA for cd332ae
File tree 2 files changed +28
-2
lines changed
2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change 4
4
| :----:| :---------:| :----:| :-----:| :----:|
5
5
| 1차시 | 2024.02.12 | DP | [ 평범한 배낭] ( https://www.acmicpc.net/problem/12865 ) | [ #1 ] ( https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/5 ) |
6
6
| 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 ) |
8
- | 4차시 | 2024.02.18 | Backtracking | [ N-queen] ( https://www.acmicpc.net/problem/9663 ) | [ #4 ] ( https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/13 ) |
7
+ | 3차시 | 2024.02.18 | DP | [ 쉬운 계단 수] ( https://www.acmicpc.net/problem/10844 ) | [ #3 ] ( https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/11 ) |
9
8
| 4차시 | 2024.02.18 | Backtracking | [ N-queen] ( https://www.acmicpc.net/problem/9663 ) | [ #4 ] ( https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/13 ) |
10
9
| 5차시 | 2024.02.24 | Backtracking | [ 입대] ( https://www.acmicpc.net/problem/31413 ) | [ #5 ] ( https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/18 ) |
11
10
| 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 ) |
12
12
---
You can’t perform that action at this time.
0 commit comments