Skip to content

Commit

Permalink
#18 22.08.14 > 2 > 연속합
Browse files Browse the repository at this point in the history
  • Loading branch information
beurmuz committed Aug 14, 2022
1 parent 399fddf commit d9d20c0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
19 changes: 19 additions & 0 deletions src/bj/silver/2/1912_re.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';

const input = require('fs').readFileSync('/dev/stdin').toString().trim().split('\n');
const n = input.shift()*1;
const progression = (''+input).split(' ').map(v => +v);

const dp = Array(n).fill(0);
dp[0] = progression[0];
let max = dp[0];

for(let i = 1; i <= n; i++) {
let item = progression[i]+dp[i-1];
if(item > max) {
dp[i] = item;
max = item;
}
}

console.log(Math.max(...dp));
6 changes: 3 additions & 3 deletions src/bj/silver/2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
||문제번호|문제명|응시 날짜|채점 결과|링크|
|:-:|:--:|:--:|:---:|:---:|--|
|1|1012|[유기농 배추](./1012.js)|22.08.06|X|[아직]()|
|2|1260|[DFS와 BFS](./1260.js)|22.08.08|[22.08.13](./1138_re.js)|[참고사이트](https://cider.tistory.com/4)|
|3|1138|[한 줄로 서기](./1138.js)|22.08.09|X|
|4|1912|[연속합](./1912.js)|22.08.10|X|
|2|1260|[DFS와 BFS](./1260.js)|22.08.08|다시!|[참고사이트](https://cider.tistory.com/4)|
|3|1138|[한 줄로 서기](./1138.js)|22.08.09|[22.08.13](./1138_re.js)|
|4|1912|[연속합](./1912.js)|22.08.10|[22.08.14](./1912_re.js)|

0 comments on commit d9d20c0

Please sign in to comment.