d6p1 - read and parse input

This commit is contained in:
Baipyrus 2023-12-08 09:55:52 +01:00
parent bb3d362aba
commit a70260cb8a

View File

@ -1,8 +1,16 @@
import { readFileSync } from "fs"; import { readFileSync } from "fs";
const t0 = performance.now(); const t0 = performance.now();
const input = readFileSync("input.txt").toString(); const input = readFileSync("input.txt").toString().split("\n");
console.log(input); const time = input[0]
.split(/\s{1,}/)
.slice(1)
.map(Number);
const distance = input[1]
.split(/\s{1,}/)
.slice(1)
.map(Number);
console.log(time, distance);
const t1 = performance.now(); const t1 = performance.now();
console.log(`Runtime: ${t1 - t0}ms`); console.log(`Runtime: ${t1 - t0}ms`);