THINKLOL - Strange Pattern (Impossible)

Mr. X is now very popular. But he feels that being popular isn't as good as he thought. He wants to return to his old way. In order to do that, he moved to a less popular language than his usual language(don't worry, it's still a popular language). Mr. X doesn't have the power of STL anymore, but he takes that as a challenge. He wants to do his infamous 2-3-3-3 function in C now.

Since Mr. X also wants to make other people forget him, the function must be so simple that it's forgettable. He only wants you to do a single statement in the function. The statement must also not contain the letter 'x'.

Mr. X has given you his code for you to edit, but you can only edit a certain part of the code.

#include <stdio.h>

int count(int x){

return edit this part;

}

int main(i){for(i=1;i%1000001;i++)printf("%d %d\n",i,count(i));return 0;}

#include <stdio.h>
int count(int x){
return (x+1)%x+2
}
int main(){
for( int i=1 ; i-1001 ; i++ ) printf("%d %d\n",i,count(i));
return 0;
}M

Mr. X will first check the correctness of the output. If the output is correct, he then will check the code. If there is anything that violates the rule above, the result will be "compilation error". Changing the code other than the allowed part may also result in a compile error.

DO NOT USE ANY WHITESPACE ON THE EDITED PART

Input

No input.

Output

1 2
2 3
3 3
4 3
... and so on ...
999998 3
999999 3
1000000 3 

Click here to see all problems in this series!


Added by:Andy
Date:2013-05-27
Time limit:1s
Source limit:250B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:C
Resource:own problem

hide comments
2020-03-08 23:41:53
IMpossible
2016-09-01 09:29:43 darryl
@eco_solution
no, it compiles just fine.
2016-08-06 02:47:33
It is easier than medium or hard :-)
2016-08-06 02:45:26
Interesting!
2016-06-07 13:43:21
It's impossible because
`int main(i){for(i=1;i%1000001;i++)printf("%d %d\n",i,count(i));return 0;}`
does not compile and we are not allowed to modify it.
2015-02-24 01:52:10 Daniel Carvalho
@hamza007, this is the "impossible" version of the problem, so you just have to search for the other versions, like /THINK.
2015-02-24 01:47:46 Daniel Carvalho
Could anyone who was able to do this question check and answer my question in stack overflow? (One can search for "access first parameter of function spoj")
2014-07-20 00:37:49 hamza007
How I am supposed to know what is the "infamous" function :/
2013-09-23 12:16:36 Abhishek Thakur
shouldnt it be i<1000001 instead of i%1000001 ?

Comment: Does that make any difference to the loop ?

Last edit: 2014-07-20 00:26:37
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.