baekjoon 20251227
This commit is contained in:
parent
8e78f3629e
commit
8057e3788c
2
code_study/Baekjoon/python/5554.py
Normal file
2
code_study/Baekjoon/python/5554.py
Normal file
@ -0,0 +1,2 @@
|
||||
time = sum([int(input()) for _ in range(4)])
|
||||
print('\n'.join(list(map(str, [time//60, time%60]))))
|
||||
20
code_study/Baekjoon/ts/1106.ts
Normal file
20
code_study/Baekjoon/ts/1106.ts
Normal file
@ -0,0 +1,20 @@
|
||||
export {};
|
||||
const input = require("fs").readFileSync(0).toString().trim().split("\n");
|
||||
|
||||
const [C, N]: number[] = input[0].split(" ").map(Number);
|
||||
let dp: number[] = Array(C+101).fill(Infinity);
|
||||
dp[0] = 0;
|
||||
|
||||
for(let n = 1; n<=N; n++) {
|
||||
const [cost, man]: number[] = input[n].split(" ").map(Number);
|
||||
|
||||
for(let i=man; i<C+101; i++) {
|
||||
if(dp[i-man] !== Infinity) {
|
||||
dp[i] = Math.min(dp[i], dp[i-man] + cost);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let ans: number = dp[C];
|
||||
for(let i=1; i<=100; i++) ans = Math.min(ans, dp[C+i]);
|
||||
console.log(ans);
|
||||
Loading…
x
Reference in New Issue
Block a user