Created
December 6, 2023 05:12
-
-
Save bluepichu/98fa08bd12d3b8147057cb548b13154e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Advent, f, fm, chr, ord } from "advent"; | |
import { Set, Map } from "immutable"; | |
const { compute, computeCheck } = await Advent({ day: 6 }); | |
compute(2, async (input) => { | |
// Time: 61 70 90 66 | |
// Distance: 643 1184 1362 1041 | |
// const data = [ | |
// { time: 61, distance: 643 }, | |
// { time: 70, distance: 1184 }, | |
// { time: 90, distance: 1362 }, | |
// { time: 66, distance: 1041 }, | |
// ]; | |
const data = [ | |
{ time: 61709066, distance: 643118413621041 } | |
] | |
let ans = 1; | |
for (let race of data) { | |
let x = 0; | |
for (let i = 0; i <= race.time; i++) { | |
if (i * (race.time - i) > race.distance) { | |
x++; | |
} | |
} | |
console.log(x) | |
ans *= x; | |
} | |
return ans; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment