simple sum november long challenge 2015

why i am getting wrong answer in simple sum problem .here is my solution for third subtask my ans is showing wrong answer.detailed explaination

Hi @rahulsup
It’s maybe an overflow issue for some big values of N




The answer is 999965000307
Your code gives 546397322511

hi @beroul my code is showing correct output on my compiler

Great question and see the interesting answers above,If you find any relevant resource related to travel and tours like Vietnam travel guide here.

Ooops. You’re right.
bad copy paste.

Good anser is 777764555617
You code gives 777764555616

Power function returns double, so (p+1) is also converted to double… Try type casting (long long int)pow()

thanks @beroul i will try to find where to correct my code