From 149c94d2f98b7737a44da1b13f604dcf564657d3 Mon Sep 17 00:00:00 2001 From: beurmuz Date: Thu, 2 Jan 2025 01:12:56 +0900 Subject: [PATCH] =?UTF-8?q?#30=204=20>=2025.01.02=20>=20=ED=94=BC=EB=B3=B4?= =?UTF-8?q?=EB=82=98=EC=B9=98=20=EC=88=98=20-=20tabulation=20=EB=B0=A9?= =?UTF-8?q?=EB=B2=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...353\251\264 \353\220\230\353\212\224 DP.js" | 18 ++++++++++++++++++ src/tree/Lv_4/README.md | 7 ++++--- 2 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 "src/tree/Lv_4/DP 1/subproblem\354\235\204 \352\267\270\353\214\200\353\241\234 \355\225\251\354\271\230\353\251\264 \353\220\230\353\212\224 DP.js" diff --git "a/src/tree/Lv_4/DP 1/subproblem\354\235\204 \352\267\270\353\214\200\353\241\234 \355\225\251\354\271\230\353\251\264 \353\220\230\353\212\224 DP.js" "b/src/tree/Lv_4/DP 1/subproblem\354\235\204 \352\267\270\353\214\200\353\241\234 \355\225\251\354\271\230\353\251\264 \353\220\230\353\212\224 DP.js" new file mode 100644 index 0000000..588290c --- /dev/null +++ "b/src/tree/Lv_4/DP 1/subproblem\354\235\204 \352\267\270\353\214\200\353\241\234 \355\225\251\354\271\230\353\251\264 \353\220\230\353\212\224 DP.js" @@ -0,0 +1,18 @@ +// ---------------------------------------------------------------------- +/** + * ๐Ÿ” ํ”ผ๋ณด๋‚˜์น˜ ์ˆ˜ | O | 25.01.02 ๐Ÿ” + */ +const N = Number( + require("fs").readFileSync("/dev/stdin").toString().trim().split("\n") +); + +// โœ… ๋‚ด ํ’€์ด - Tabulation (for๋ฌธ, bottom-up ๋ฐฉ์‹) +const dp = Array.from({ length: N + 1 }, () => 0); + +dp[1] = 1; +dp[2] = 1; + +for (let i = 3; i <= N; i++) { + dp[i] = dp[i - 1] + dp[i - 2]; +} +console.log(dp[N]); diff --git a/src/tree/Lv_4/README.md b/src/tree/Lv_4/README.md index 1341985..2c199cb 100644 --- a/src/tree/Lv_4/README.md +++ b/src/tree/Lv_4/README.md @@ -1,5 +1,6 @@ # I_LOW -| ํ•™์Šต์ผ | ๋ชฉ์ฐจ | ์ฃผ์ œ | ์ œ๋ชฉ ๋ฐ ์ •๋‹ต์—ฌ๋ถ€ | -| :----------------: | :--------- | :--------------------------------------------------------------- | :----------------------------------------------------------------------------------- | -| 24.09.23-24, 09.27 | Simulation | [๊ฒฉ์ž ์•ˆ์—์„œ ์™„์ „ํƒ์ƒ‰](./Simulation/๊ฒฉ์ž%20์•ˆ์—์„œ%20์™„์ „ํƒ์ƒ‰.js) | ์ตœ๊ณ ์˜ 33์œ„์น˜ (O)
ํ–‰๋ณตํ•œ ์ˆ˜์—ด์˜ ๊ฐœ์ˆ˜ (O)
ํŠธ๋กœ๋ฏธ๋…ธ (โ–ณ)โญ๏ธ
๊ธˆ ์ฑ„๊ตดํ•˜๊ธฐ (X)โญ๏ธ | +| ํ•™์Šต์ผ | ๋ชฉ์ฐจ | ์ฃผ์ œ | ์ œ๋ชฉ ๋ฐ ์ •๋‹ต์—ฌ๋ถ€ | +| :----------------: | :--------- | :------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------- | +| 24.09.23-24, 09.27 | Simulation | [๊ฒฉ์ž ์•ˆ์—์„œ ์™„์ „ํƒ์ƒ‰](./Simulation/๊ฒฉ์ž%20์•ˆ์—์„œ%20์™„์ „ํƒ์ƒ‰.js) | ์ตœ๊ณ ์˜ 33์œ„์น˜ (O)
ํ–‰๋ณตํ•œ ์ˆ˜์—ด์˜ ๊ฐœ์ˆ˜ (O)
ํŠธ๋กœ๋ฏธ๋…ธ (โ–ณ)โญ๏ธ
๊ธˆ ์ฑ„๊ตดํ•˜๊ธฐ (X)โญ๏ธ | +| 25.01.02 | DP 1 | [subproblem์„ ๊ทธ๋Œ€๋กœ ํ•ฉ์น˜๋ฉด ๋˜๋Š” DP](./DP%201/subproblem์„%20๊ทธ๋Œ€๋กœ%20ํ•ฉ์น˜๋ฉด%20๋˜๋Š”%20DP.js) | ํ”ผ๋ณด๋‚˜์น˜ ์ˆ˜ (O)
|