2019 day 01 yay

This commit is contained in:
Tristan 2019-12-01 09:19:03 +00:00
parent f6e6bd69c7
commit 6facbd56de
5 changed files with 281 additions and 0 deletions

11
2019/01/part1.js Normal file
View file

@ -0,0 +1,11 @@
const fs = require('fs');
let input = fs.readFileSync('input.txt', 'utf-8');
let totalFuel = 0;
input.split('\n').forEach(line => {
num = parseInt(line);
if (num){
totalFuel += Math.floor(num/3)-2;
}
});
console.log(totalFuel);