Hello everyone : I solved Broken clock with very intuitive naive approach but i didnt get why it is not working for some subtasks .. The approach is discussed below hope u like it.
ans=(ld)((ld)(cos (anglePI/180.0))(ld)length); //cosine formula simple cos(angle) till now from the base line which is the (complete y axis line * length of the minute arm) (constant) we get the y coord of the end point of the minute arm after a patricular second in an loop. 3.If i am in 2 quadrant where if(angle > (ld)90.0 && angle<(ld)180.0) {//2 quad
As u can see i use sin approach in 2 quad but by taking the angle with respect to the x axis thats why i subtracted total angle with 90 to get new angle angle 2 with respect to the x axis .. when final ans is calulated i put a negative sign Now similarly in 3 quad else if(angle>(ld)180.0&&angle<(ld)270.0) {//3 qaud
And in 4 quad else if(angle>(ld)270.0&&angle<(ld)360.0){//door tak repeat nhi ho payenge vo
Now if angle exceeds 360 degrees else if(angle>(ld)360.0) {
Let me remember you that the angle which we are calulated is in double so all the ans in every iteration are in double values as i typecasted them in to double in every equation.. Now finally lets say the ans which is calulated after t sec is accurate up to 6 decimal places by using fixed setprecison(9) 4 I uses gcd approach to find the rational form //ans which we obtained after t seconds
5 And then fianlly result=mulmod((modInverse(deno,mod)),numo,mod);
pLzz refer to my solution below i explained each and every thing in the code below plzz help me at least partial acceptance should be their for my approahch as no tle comes why WA comes any help will be so benefit for me THNKSS FOR ADVANCE..
This question is marked "community wiki".
asked 14 Feb '18, 16:28

As @square_root_pi said, you need to calculate the value in fractions and fractions alone, as that is required in the output format. You cannot use any floating point data type as then you will lose precision. Handling all the calculations without using float is the real challenge. I have written an editorial on how to do that.. https://discuss.codechef.com/questions/122855/broclkeditorialnonmatrixapproachunofficial answered 14 Feb '18, 17:59
but i calculated values up to 8 or 6 decimal points with precision even then the ans will be wrong i didnt understand this as finally if my double values are accurate up to 3 decimal digits or 6 decimal digits after the decimal point the fraction form which i obtained by performing gcd will still be the same then where is the point of loosing precision and where it will affect my ans i'm not clear with that plzz help @paintbrush @taran_1407 ?
(15 Feb '18, 16:07)

u r calculating value in double and how will u calculate it to fraction without any loss of precision https://www.codechef.com/problems/QTREE this qtree question if stuck see this solution answered 14 Feb '18, 16:40

@coder_ishmeet even if u calculate upto infinite decimal places ur answer wll be wrong because float and double itself gives wrong values in decimals answered 15 Feb '18, 17:05

as in double 1.999.... is converted to 2,so if we take int of it (1.999...) then it converted to 1,then how check this condition? plz help... answered 15 Feb '18, 22:24
