Last active
February 23, 2016 00:03
-
-
Save vovanmix/daec6991c79a848be633 to your computer and use it in GitHub Desktop.
This file contains 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 | |
$handle = fopen ("php://stdin","r"); | |
fscanf($handle,"%d",$t); | |
for($a0 = 0; $a0 < $t; $a0++){ | |
fscanf($handle,"%d %d",$n,$k); | |
$a_temp = fgets($handle); | |
$a = explode(" ",$a_temp); | |
array_walk($a,'intval'); | |
} | |
///###### | |
function writeOutput($output){ | |
fwrite(STDOUT, $output . "\n"); | |
} | |
function readInput($rows, $function = null){ | |
$results = []; | |
for($i = 0; $i < $rows; $i++){ | |
if($function){ | |
$results[] = $function(); | |
} | |
else{ | |
$results[] = fgets(STDIN); | |
} | |
} | |
return $results; | |
} | |
///###### | |
// array_walk($array, "intval"); | |
$array = array_map("intval", $array); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment