I was solving this problem on SPOJ.
http://www.spoj.com/problems/NECSTASY/
And this my code.
#include <iostream>
#include <iomanip>
#include <cmath>
#include <fstream>
const float PI=3.14159265;
using namespace std;
int main()
{
float d,x,y,t;
while((cin >> d >> x >> y >>t)!=EOF)
{
float u= PI*(t/180);
float l = (d-y);
float k = l*(1/sin(u/2));
float h = k+x;
cout << fixed << setprecision(2) << h << endl;
}
return 0;
}
I am facing a problem with the fact that no of test cases is not given.
How do I deal with that??