2022-12-01 21:02:00 +01:00
|
|
|
#!/usr/bin/env php
|
|
|
|
<?php
|
|
|
|
|
|
|
|
$input = file_get_contents("input");
|
|
|
|
$input = explode(",", $input);
|
|
|
|
|
2022-12-01 21:02:00 +01:00
|
|
|
$days = 80;
|
2022-12-01 21:02:00 +01:00
|
|
|
|
|
|
|
for($day=0; $day<$days; $day++){
|
|
|
|
|
|
|
|
foreach($input as $i => &$v) {
|
|
|
|
$v--;
|
|
|
|
if($v == -1) {
|
|
|
|
$v = 6;
|
|
|
|
$input[] = 9;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "Total number of fish after $days days: " . count($input);
|
|
|
|
|
|
|
|
?>
|