Skip to content

Instantly share code, notes, and snippets.

@bluepichu
Created December 6, 2023 05:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bluepichu/98fa08bd12d3b8147057cb548b13154e to your computer and use it in GitHub Desktop.
Save bluepichu/98fa08bd12d3b8147057cb548b13154e to your computer and use it in GitHub Desktop.
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