Can anyone help me why this is showing wrong answer?

https://www.codechef.com/viewsolution/45321570
This my link for solution. I used other codes for comparison and got same answers yet the compiler is showing wrong answer.

Use long long int instead of int as the value of sum will overflow, and try to use tabulation to improve runtime.

1 Like