baekjoon 20251213
This commit is contained in:
parent
191ed33a88
commit
e8636c6b99
1
code_study/Baekjoon/python/2752.py
Normal file
1
code_study/Baekjoon/python/2752.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
print(' '.join(map(str,sorted(map(int,input().split())))))
|
||||||
15
code_study/Baekjoon/ts/12865.ts
Normal file
15
code_study/Baekjoon/ts/12865.ts
Normal file
@ -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]);
|
||||||
Loading…
x
Reference in New Issue
Block a user