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 | 31 |
Tags
- ๋ฐฑ์ค 1339๋ฒ nodejs
- next13 emotion
- ํ๋ก๊ทธ๋๋จธ์ค ๋ฌธ์์ด ์์ถ
- ์๋ฐ์คํฌ๋ฆฝํธ ์ค์ฝํ
- emotion RSC
- ์๋ฐ์คํฌ๋ฆฝํธ ๋ฌธ์์ด ์์ถ
- ์ค์ฝํ
- ์นด์นด์ค ์ฝํ
- suspense ๋์์๋ฆฌ
- suspense react-query
- ๋ฐฑ์ค 1339๋ฒ js
- ๋ฐฑ์ค 2108 ์๋ฐ์คํฌ๋ฆฝํธ
- suspense ๋น๋๊ธฐ
- suspense ๋ณ๋ชฉํ์
- js ๊ฑฐ๋ฆฌ๋๊ธฐ ํ์ธํ๊ธฐ
- ๊ตฌ๋ฆํค ์ฑ๋ฆฐ์ง ํ๊ณ
- ๋ฐฑ์ค 1339๋ฒ ์๋ฐ์คํฌ๋ฆฝํธ
- ๋ฆฌ์กํธ์ฟผ๋ฆฌ suspense
- js ์ค์ฝํ
- TypeError: createContext only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more:
- app router emotion
- emtion app router
- ์ฌ์ฉ์ฑ ๊ฐ์
- ๋ฐฑ์ค 2108 nodejs
- ํ๋ก๊ทธ๋๋จธ์ค ๊ฑฐ๋ฆฌ๋๊ธฐ ํ์ธํ๊ธฐ
- ์ต์ ๋์ฒด์ด๋
- ๊ตฌ๋ฆํค ์ฑ๋ฆฐ์ง
- js
- ๊ตฌ๋ฆํค
- js ๋ฌธ์์ด ์์ถ
Archives
- Today
- Total
Lennon FE
[๋ฐฑ์ค 2579๋ฒ] ๊ณ๋จ์ค๋ฅด๊ธฐ - ์๋ฐ์คํฌ๋ฆฝํธ(nodejs) ๋ณธ๋ฌธ
๐ฅ Algorithm/Baekjoon
[๋ฐฑ์ค 2579๋ฒ] ๊ณ๋จ์ค๋ฅด๊ธฐ - ์๋ฐ์คํฌ๋ฆฝํธ(nodejs)
Lennon 2022. 3. 11. 16:35728x90
๋ฐ์ํ
https://www.acmicpc.net/problem/2579
const fs = require('fs');
let [n, ...input] = fs.readFileSync('dev/stdin').toString().trim().split('\n');
input = input.map(Number);
const dp = [];
dp[0] = input[0];
dp[1] = Math.max(input[0] + input[1], input[1]);
dp[2] = Math.max(input[0] + input[2], input[1] + input[2]);
for (let i = 3; i < input.length; i++) {
dp[i] = Math.max(input[i] + input[i - 1] + dp[i - 3], input[i] + dp[i - 2]);
}
console.log(dp[+n - 1]);
์ ํ์ ์ธ DP๋ฌธ์ ์ด๋ค. ์ ํ์์ ์๊ฐํ๋ ๊ฒ ์ค์ํ๋ค.
728x90
๋ฐ์ํ
'๐ฅ Algorithm > Baekjoon' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
Comments