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.

Calculate angle with
angle = (ld)((ld)acos ((ld)d/length) * (ld)180.0) / PI;
//arch cosine for inverse angular calculations.
ld refers to the long double or an double value valid for both. 
As we get initial angle then i iterate through simple loop till the final time is not reached as the angle is fixed i increment the angle with the initial angle calulated above and at every step of iteration if we are in first quad i uses
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
ld angle2=angle;angle2=(ld)90.0;//angle ki copy banayi
ans=(ld)((ld)length*(ld)((sin (angle2*PI/180.0))));
ans=ans;
// ct1(ans);//exit(0);
}
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
ld angle2=angle;angle2=(ld)180.0;
// angle=180;
ans=(ld)((ld)(cos (angle2*PI/180.0))*(ld)length);
ans=ans;
}
And in 4 quad
else if(angle>(ld)270.0&&angle<(ld)360.0){//door tak repeat nhi ho payenge vo
ld angle2=angle;angle2=(ld)270.0;
ans=(ld)((ld)length*(ld)(sin (angle2*PI/180.0)));
}
Now if angle exceeds 360 degrees
else if(angle>(ld)360.0) {
angle=(ld)360.0;
// is ubtracted 360 from it to get the new angle from the base line and then
applying the cos approach as it is again comes to the 1 quadrant
ans=(ld)((ld)(cos (angle*PI/180.0))*(ld)length);
}
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
ll tempnum=(ll)(ans*1000000),tempdeno=1000000;
ll gco=mygcd(tempnum,tempdeno);
// ct1(gco);
ll numo=tempnum/gco;
ll deno=tempdeno/gco;
5 And then fianlly
result=mulmod((modInverse(deno,mod)),numo,mod);
a. modinverse by fermats little theorem
b. mulmod for multiplyign the negative or positive large values to ensure no overflow occurs
c. And then finally taking mod with repect to the mod (1000000007)
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…