I tried this problem. However, I am not getting correct answers. Please tell me what is wrong in my code
Link:
I tried this problem. However, I am not getting correct answers. Please tell me what is wrong in my code
Link:
@HemantKumar
when performing subtraction under modulo do this
( (a-b)%mod + mod)%mod
Rest your code seems fine
@HemantKumar
Make line 108 this
cout<<((sumUptoN-sumUptoN)%p+p)%p<<endl;
Notice
( (a-b)%mod + mod)%mod