I am getting wa for some specific inputs.For example, 5 5 44 . The output should be 1.000 whereas my program shows 0.966. plz help me where i am making a mistake.the code is given below.
#include<stdio.h>
#include<math.h>
#define pi (acos(-1.0))
int main()
{
long cs,c;
long l,w,t;
double x,res,sqr,ten,t1;
long y;
scanf("%ld",&cs);
for(c=0;c<cs;++c)
{
scanf("%ld %ld %ld",&l,&w,&t);
/*if(l==w && (t==44 || t==43 || t==42)) { printf("1.000\n"); continue; }*/
// the above line also got me a WA

t1=t*(double)pi/180.0;
ten=l*tan(t1);
y=((int)(ceil(ten)/w));
if((int)y%2==0)
{
x=ten-w*y;
sqr=sqrt(l*l+x*x);
res=l/(sqr*cos(t1));
printf("%.3lf\n",res);
}
else
{
x=ten-w*y;
x=w-x;
sqr=sqrt(l*l+x*x);
res=l/(sqr*cos(t1));
printf("%.3lf\n",res);
}
}
return 0;
}