Created
December 2, 2015 09:02
-
-
Save phroggyy/485b12ffbc82cde400c3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
array_walk($x=file('i'),function(&$g) { | |
$g=explode('x', $g); | |
sort($g, SORT_NUMERIC); | |
}); | |
$p = $r = 0; | |
foreach ($x as $g) { | |
$p += 2*($g[0]*$g[1] + $g[0]*$g[2] + $g[1]*$g[2]) + $g[0]*$g[1]; | |
$r += 2*($g[0]+$g[1])+array_product($g); | |
} | |
echo "paper: $p\nribbon: $r\n"; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment