Advertisement
NAbdulla

Think Different

Apr 2nd, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <cstdio>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     int i, t;
  10.     double   a, // area of ADMN
  11.             BD,
  12.             AP,
  13.             AB,
  14.             BC,
  15.             ang_ABC;
  16.     cin >> t;
  17.     i = 1;
  18.     while(i <= t){
  19.         cin >> BD >> a;
  20.         a = sqrt(a); //length of each side of ADMN
  21.         ang_ABC = atan(a/BD);
  22.         AB = BD/cos(ang_ABC);
  23.         BC = AB/cos(ang_ABC);
  24.  
  25.         AP = BC/2; //length of AP=BP=CP
  26.         printf("Case %d: %lf\n", i++, AP);
  27.     }
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement