This commit is contained in:
2025-11-11 04:41:56 +01:00
parent 0c69ceb612
commit 88756bdce7
2 changed files with 45 additions and 0 deletions

21
src/2015/2/1/index.ts Normal file
View File

@@ -0,0 +1,21 @@
export default async function runner(inputPath: string) {
const input = await Bun.file(inputPath).text();
let totalArea = 0;
input.split("\n").forEach(line => {
if (line.trim() === '') return;
const [l, w, h]: number[] = line.split("x") as unknown as number[];
if(!l || !w || !h) return;
const s1 = l*w;
const s2 = w*h;
const s3 = l*h;
const a = 2*s1 + 2*s2 + 2*s3 + Math.min(s1, s2, s3);
totalArea += a;
})
console.log(totalArea)
}

24
src/2015/2/2/index.ts Normal file
View File

@@ -0,0 +1,24 @@
export default async function runner(inputPath: string) {
const input = await Bun.file(inputPath).text();
let totalArea = 0;
input.split("\n").forEach(line => {
if (line.trim() === '') return;
const [l, w, h]: number[] = line.split("x") as unknown as number[];
if(!l || !w || !h) return;
const c1 = 2*l+2*w;
const c2 = 2*w+2*h;
const c3 = 2*l+2*h;
const v = l*w*h;
const a = Math.min(c1, c2, c3) + v;
totalArea += a;
})
console.log(totalArea)
}