26 lines
531 B
PHP
26 lines
531 B
PHP
<?php
|
|
|
|
$numbers = array_map('intval', explode("\n", file_get_contents('input.txt')));
|
|
|
|
$current_index = 0;
|
|
|
|
//$sum = 127;
|
|
$sum = 257342611;
|
|
|
|
while (true) {
|
|
$index = $current_index;
|
|
$current_sum = 0;
|
|
$used_numbers = [];
|
|
while ($current_sum <= $sum) {
|
|
if ($sum === $current_sum) {
|
|
echo min($used_numbers) + max($used_numbers);
|
|
exit;
|
|
}
|
|
|
|
$used_numbers[] = $numbers[$index];
|
|
$current_sum = array_sum($used_numbers);
|
|
$index++;
|
|
}
|
|
$current_index++;
|
|
}
|