thanks. i sweat it out to find the pattern. surprised to see so simple recurrence. i got AC with precalculation as you said. i don't know how to solve the recurrence. then i could solve it in constant time.
well... it is not fair to post the recurrence directly. plz who ever did it, delete that. u may give him enough hint but not direct recurrence!
if u have a close look, then u will realize it is fibonacci. but if u want to formulate it there is a big chance to get precission error (i think u know the direct formula for fib series.)
Please guys, remove those posts that give the solution to this problem. The boards are meant to discuss problems, not to give spoilers.
mf: I know you responded to a request for proof, but you should give that in a PM, not publicly on the board.
easy problem...
but i want to know what is the provision for terminating the program..??
"The input will be terminated by EOF",i didnt understand what it meant
just write down
while(!EOF){
cin>>xxx;
cout<<xxx;
}