Hi,
I have written code for following problem: http://www.codechef.com/problems/MARCHA4/
Below is my code for the same in PHP.
//Suppose below are my posted array
$nTimeMul = array(4,9);
$nToAppear = array(2,3);
function getDezireOutput($nTimeMul = array(), $nToAppear = array()) {
$i = 0;
foreach ($nTimeMul as $num) {
$tempNum = 1;
for ($t=0; $t < $num; $t++) {
$tempNum = $tempNum * $num;
}
echo substr ($tempNum, 0, $nToAppear[$i]).' '.substr ($tempNum, -$nToAppear[$i]).'
';
$i++;
}
}
getDezireOutput ($nTimeMul, $nToAppear);
Can anyone tell me what is wrong with above code for that problem?