RedBtats's blog

By RedBtats, history, 9 months ago, ,

hello

i was trying to solve this problem on a2oj https://a2oj.com/p?ID=292 and it keeps giving me wrong answer and i don't know where is the mistake in my equations so any help is appreciated

 » 9 months ago, # |   +2 Can you please briefly explain what everything in your code does? People aren't interested in debugging unreadable and unannotated code.Also make a class for modular arithmetic for god's sake, with this thing: %mod))%mod )%mod; you're bound to make an error sooner or later.Anyway this is how you can get out of those situations: make a program to generate thousands of small test cases. Make another "naive" solution (or in this case you can copy someone's accepted solution) and compare the outputs on the small test cases. This way you're bound to find a small test case where your program gives the wrong output. Then you can find out where your logic is wrong.