advent_of_code_2019/day_1/part_1.php

9 lines
167 B
PHP
Raw Permalink Normal View History

2019-12-06 14:32:52 +01:00
<?php
$masses = explode(',', file_get_contents('input.txt'));
echo array_sum(
array_map(function($mass) {
return floor($mass / 3) - 2;
}, $masses)
);