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 SkihXn - Online C++ Compiler & Debugging Tool - Ideone.com

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

Try

1

999983

The answer is 999965000307
Your code gives 546397322511

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

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

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

Ooops. You’re right.
bad copy paste.
Try
1
999993

Good anser is 777764555617
You code gives 777764555616

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