From 38460469fde6584a6b904a1e42fed1ed8cbd5be0 Mon Sep 17 00:00:00 2001 From: songyc macbook Date: Tue, 21 Apr 2026 18:10:03 +0900 Subject: [PATCH] baekjoon 20260421 --- code_study/Baekjoon/python/15680.py | 1 + code_study/Baekjoon/ts/2533.ts | 30 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 code_study/Baekjoon/python/15680.py create mode 100644 code_study/Baekjoon/ts/2533.ts diff --git a/code_study/Baekjoon/python/15680.py b/code_study/Baekjoon/python/15680.py new file mode 100644 index 0000000..9844393 --- /dev/null +++ b/code_study/Baekjoon/python/15680.py @@ -0,0 +1 @@ +print("Leading the Way to the Future" if int(input()) else "YONSEI") \ No newline at end of file diff --git a/code_study/Baekjoon/ts/2533.ts b/code_study/Baekjoon/ts/2533.ts new file mode 100644 index 0000000..1b6daed --- /dev/null +++ b/code_study/Baekjoon/ts/2533.ts @@ -0,0 +1,30 @@ +export {}; + +const input = require("fs").readFileSync(0).toString().trim().split('\n'); + +const N: number = Number(input[0]); +let graph: number[][] = Array.from({length: N+1}, () => []); +for(let i=1; i new Array(2).fill(0)); + +const dfs = (n: number) => { + visited[n] = true; + dp[n][0] = 1; + + for(let nxt of graph[n]) { + if(visited[nxt]) continue; + + dfs(nxt); + dp[n][1] += dp[nxt][0]; + dp[n][0] += Math.min(dp[nxt][0], dp[nxt][1]); + } +}; + +dfs(1); +console.log(Math.min(dp[1][0], dp[1][1])); \ No newline at end of file