Skip to content

Instantly share code, notes, and snippets.

@vovanmix
Last active February 23, 2016 00:03
Show Gist options
  • Save vovanmix/daec6991c79a848be633 to your computer and use it in GitHub Desktop.
Save vovanmix/daec6991c79a848be633 to your computer and use it in GitHub Desktop.
<?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