Code not working

Can anyone please tell me why am I getting wrong answer for this question.
Problem Link - https://www.codechef.com/problems/IMPACT
Solution Link - https://www.codechef.com/viewsolution/25500574
If possible please provide me the test case in which it is failing.

Thank you in advance.

The question is a bit vague, but if I’m understanding correctly: try this testcase:

1
1 12 35831808 84

(NB: 12 ** 7 == 35831808)

Your solution appears to give “no” for this, but (again, if I understand it correctly!) the answer should be “yes” - this should hopefully allow you to debug your approach :slight_smile:

Edit:

Oh, and welcome :slight_smile:

Edit2:

Although my non-brute-force solution is getting WA, so maybe you should just ignore all this XD

Edit3:

What a Comedy of Errors that was XD! AC now. Note to self: 1) stop making absurdly stupid assumptions(!!); 2) stop arbitrarily disallowing certain values in your testcase generator(!)

I’m just imagining the furore if this problem had been categorised as “Easy” on Hackerrank - look what happened with this (far easier) one: https://www.hackerrank.com/challenges/richie-rich/forum/comments/162333