8000 Merge pull request #46 from Hot6Maina/patch-12 · twinkite/basic-algo-lecture@92497cf · GitHub
[go: up one dir, main page]

Skip to content

Commit 92497cf

Browse files
Merge pull request encrypted-def#46 from Hot6Maina/patch-12
Update 1932.cpp
2 parents 4eb110f + c548b98 commit 92497cf

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

0x10/solutions/1932.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
1-
// Authored by : BaaaaaaaaaaarkingDog
1+
// Authored by : Hot6Mania
22
// Co-authored by : -
3-
// http://boj.kr/****************
3+
// http://boj.kr/b5c330a8f8684bca91511e8ea2a19a34
44
#include <bits/stdc++.h>
55
using namespace std;
66

7+
int n;
8+
int a[505][505], d[505][505];
9+
710
int main(void){
811
ios::sync_with_stdio(0);
912
cin.tie(0);
1013

11-
}
14+
cin >> n;
15+
for(int i = 1; i <= n; ++i)
16+
for(int j = 1; j <= i; ++j)
17+
cin >> a[i][j];
18+
d[1][1] = a[1][1];
19+
for(int i = 2; i <= n; ++i)
20+
for(int j = 1; j <= i; ++j)
21+
d[i][j] = max(d[i-1][j-1], d[i-1][j]) + a[i][j];
22+
cout << *max_element(d[n] + 1, d[n] + n + 1);
23+
}

0 commit comments

Comments
 (0)
0