Advertisement
shamiul93

LightOJ 1056 - Olympics

Mar 4th, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. /**
  2. @author - Rumman BUET CSE'15
  3.  
  4. Problem - 1056 - Olympics
  5.  
  6. concept -
  7.  
  8.     It's in binary search category.
  9.     It can be easily solved with bisection.
  10.     But it can be solved more easily by just geometric calculation.
  11.     So, go on.
  12.  
  13. */
  14.  
  15. #include<bits/stdc++.h>
  16. using namespace std ;
  17. #define ll long long
  18. #define fo freopen("out.txt","w",stdout)
  19. #define fi freopen("in.txt","r",stdin)
  20.  
  21. #define pi acos(-1)
  22.  
  23. using namespace std ;
  24.  
  25. int main()
  26. {
  27.     ll T , t = 0 ;
  28.     scanf("%lld",&T);
  29.  
  30.     while(T--)
  31.     {
  32.         t++ ;
  33.         double a , b ;
  34.         double alpha , theta ;
  35.         double x ;
  36.  
  37.         scanf("%lf : %lf",&a , &b);
  38.  
  39.         alpha = atan(a/b*1.0) ;
  40.         theta = pi - 2.0*alpha ;
  41.  
  42.  
  43.         x= 400.0 / ( 2.0*a + theta * sqrt(a*a + b*b) ) ;
  44.  
  45.         printf("Case %lld: %.10f %.10f\n" , t , a*x*1.0 , b*x*1.0) ;
  46.     }
  47.  
  48.     return 0 ;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement