Skip to content

Instantly share code, notes, and snippets.

@dflima
Created November 7, 2017 18:28
Show Gist options
  • Save dflima/31f26a63a6cbb8c32d2f865f39823d85 to your computer and use it in GitHub Desktop.
Save dflima/31f26a63a6cbb8c32d2f865f39823d85 to your computer and use it in GitHub Desktop.
<?php
$handle = fopen ("php://stdin", "r");
$arr_temp = fgets($handle);
$arr = explode(" ",$arr_temp);
$arr = array_map('intval', $arr);
sort($arr, SORT_NUMERIC);
$first_a = $last_a = $arr;
array_pop($first_a);
array_shift($last_a);
printf("%d %d\n", array_sum($first_a), array_sum($last_a));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment