Please help me in MAANDI


CodeChef: Practical coding for everyone <—solution

MAANDI Problem - CodeChef <----problem

Getting WA! i think there is a small flaw maybe could you check where am i going wrong? i used 100 testcases from a generator and ran through it my code and a correct code, they matched perfectly! i dont know what’s wrong.

For this test:



Your code output 7. The correct answer is 5 (37,74,75,370,2775 are the lucky numbers).
Your code counted 74 and 75 twice.

This can be handled by changing math.ceil(inp**0.5) to math.floor(inp**0.5).

Also, for this case



correct answer is 1 (the lucky number is 4). Your code counted 4 twice.

To avoid this, change if j!=inp//2 to if inp!=j*j.

I’ve rewritten your code and got Accepted. Link:

Ohk! got it…