Please check my code. Why codechef giving it wrong?


I have written code for following problem:

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]).'

getDezireOutput ($nTimeMul, $nToAppear);

Can anyone tell me what is wrong with above code for that problem?

Try the easier problems first to get familiar with the environment. Read also FAQ, to understand how contest pages like this one works.

First of all - you have to read the input from standard input, there are several test inputs, not only those in problem statement.

You can use this question chain for further discussion