adventofcode-2016/day03/part1.js
2016-12-03 14:55:12 +00:00

4 lines
286 B
JavaScript

var input = require("fs").readFileSync("input.txt").toString().replace(/\r/g, "");
var triangles = input.split("\n").map((a)=>(a.split(" ").filter((b)=>(b)).map((b)=>(parseInt(b))))).filter(([a, b, c])=>(((a + b) > c) && ((b + c) > a) && ((a + c) > b)));
console.log(triangles.length);