diff --git a/code_study/Baekjoon/python/2752.py b/code_study/Baekjoon/python/2752.py new file mode 100644 index 0000000..d8bcf99 --- /dev/null +++ b/code_study/Baekjoon/python/2752.py @@ -0,0 +1 @@ +print(' '.join(map(str,sorted(map(int,input().split()))))) \ No newline at end of file diff --git a/code_study/Baekjoon/ts/12865.ts b/code_study/Baekjoon/ts/12865.ts new file mode 100644 index 0000000..f24b476 --- /dev/null +++ b/code_study/Baekjoon/ts/12865.ts @@ -0,0 +1,15 @@ +export {}; +const input = require("fs").readFileSync(0).toString().trim().split("\n"); + +const [N, K]: number[] = input[0].split(" ").map(Number); +let items: number[][] = Array.from({length: N}, (_, i) => input[i+1].split(" ").map(Number)); + +let dp: number[] = Array(K+1).fill(0); + +for(let [w,v] of items) { + for(let k=K; k>=w; k--) { + dp[k] = Math.max(dp[k-w] + v, dp[k]); + } +} + +console.log(dp[K]); \ No newline at end of file