Hi All,

My python program is giving same output as expected and I have matched it with main solution provided by Author

my prog:

Same is working fine when I am running on code chef but not when I am submitting the code

Hi @shilayadav,

The question asks for the Kth angle’s irreducible fraction’s denominator and numerator. I am sorry that I couldn’t understand your code properly. But, I have rewritten your code in a way I could understand. I think your mistake might be in the last few steps.

My code

I have used the Fraction class for getting the numerator and denominator such that GCD(x,y)=1

I hope that I have cleared your doubt.


PS: You don’t need to check the constraints using try and except. It states that the input for testing will be within the constraints mentioned.