fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. long double d,x,y,tha,tmp,pi=acos(-1);
  7. while(cin>>d>>x>>y)
  8. {
  9. cin>>tha;
  10. /*
  11. sin(theta)=P/(H); (here theta=theta/2, p=d-y)
  12. so,
  13. H=(d-y)/(sin(theta/2);
  14. */
  15. tha=(2*acos(-1)*(tha))/360.000; //operating in radians
  16. tha/=2;
  17. tmp=sin(tha);
  18. tmp=(d-y)/tmp;
  19. tmp+=x;
  20.  
  21. printf("%.2Lf\n",tmp);
  22. }
  23. return 0;
  24. }
Success #stdin #stdout 0s 4516KB
stdin
Standard input is empty
stdout
Standard output is empty