Doubt in codeforces

https://codeforces.com/gym/320678/problem/A

Please tell the bug in code !

hello @prerak_semwal
the problem is not accessible to me, i guess its a part of any ongoing contest.
ss

pls wait for contest to end

@aman212yadav

bhaiya,
it already over at 8pm…it’s just you don’t have registered id for ACM contest…
I might be last person on earth to cheat…I have not cheated once in my life whether its sports or studies…it’s record of mine i’m proud of…that day i quitted the contest…but my wrong code was bothering me so I asked you…I forgot that day that contest would have been still running !

no issue bro, acutally the questions are not accessible to me so i thought these questions are part of any ongoing contest , hence i told u to ask later.

@aman212yadav
yes bhaiya. I just wanted to make you aware of my nature of not cheating… I know that you don’t know me and almost everyone don’t resist malpractices !!

I’m sharing question copy-paste format:-

use mod property in this line ->

         a[i]=a[i-1]+a[i-2]+a[i-3];

also u have used a[1]=0 (once cross check what they have defined for 0,1,2)

@aman212yadav

a[1]=0 only.

What’s the mod property?
what’s wrong in my logic?

modulo arithmetic property.

    a[i]=(a[i-1]+a[i-2]+a[i-3])%31;

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.