Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $array = explode(' ', readline());
- $condensed = $array;
- while (count($array) > 1) {
- $condensed = [];
- for ($i = 0; $i < count($array) - 1; $i++) {
- $condensed[] = intval($array[$i]) + intval($array[$i + 1]);
- }
- $array = $condensed;
- }
- echo $condensed[0];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement