v 0. Pasted by slipstak2 as cpp at 2011-01-11 14:13:37 MSK and set expiration to never.

Paste will expire never.

  1. // Меньшиков. Тренировка 14.
  2. // 14D. Пирамиды [pyramids]
  3. // ibelyaev: 10Jan2011
  4.  
  5. #include <iostream>
  6. #include <cstdio>
  7. #include <cmath>
  8.  
  9. using namespace std;
  10.  
  11. double AB,AC,AD,BC,BD,CD;
  12. void input()
  13. {
  14.     cin>>AB>>AC>>AD>>BC>>BD>>CD;
  15. }
  16. void solve()
  17. {
  18.     double Xb = AB;
  19.     double Xc = (AC*AC - BC*BC + AB*AB) / (2*AB);
  20.     double Yc = sqrt(AC*AC - Xc*Xc);
  21.  
  22.     double Xd = (AD*AD + AB*AB - BD*BD) / (2*AB);
  23.     double Yd = (AD*AD - CD*CD - 2*Xc*Xd + Xc*Xc + Yc*Yc) / (2*Yc);
  24.     double Zd = sqrt(AD*AD - Xd*Xd - Yd*Yd);
  25.  
  26.     double S = Xb*Yc*Zd / 6.0;
  27.     printf("%0.4f",S);
  28.    
  29. }
  30. int main()
  31. {
  32.     freopen("input.txt","r",stdin);
  33.     freopen("output.txt","w",stdout);
  34.  
  35.     input();
  36.     solve();
  37.     return 0;
  38. }


Editing is locked.