daily pastebin goal
78%
SHARE
TWEET

Untitled

a guest Dec 6th, 2017 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. for ($mem = array_map('intval', explode("\t", trim(file_get_contents('input.txt')))), $hist = []; count($hist) == count(array_unique($hist)); $hist[] = implode("-", $mem)) {
  3.     for ($mem[$i = array_search($blocks = max($mem), $mem)] = 0; $blocks > 0; $blocks--) {
  4.         $mem[(++$i) % count($mem)]++;
  5.     }
  6. }
  7. echo "Part One: " . count($hist) . PHP_EOL . "Part Two: " . (count($hist) - 1 - array_search($hist[count($hist) - 1], $hist)) . PHP_EOL;
RAW Paste Data
Top