Advertisement
Guest User

Untitled

a guest
Sep 14th, 2012
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include <cmath>
  2. #include <iostream>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7. const double PI = 3.14159265;
  8.  
  9. struct cone{ double r1,r2; };
  10.  
  11. inline double countx(const double &R1,const double &R2,const double &H,const double &D){
  12.  if(H<=D) return R2;
  13.  return (R1*(H-D) + R2*D)/H;
  14.  }
  15.  
  16. int main(){
  17. double a,b,d,h;
  18. cin >> a >> b >> d;
  19. cone c1, c2;
  20. cin >> c1.r1 >> c1.r2; cin >> c2.r1 >> c2.r2;
  21. cin >> h;
  22. double x1 = countx(c1.r1,c1.r2,h,d);
  23. double x2 = countx(c2.r1,c2.r2,h,d);
  24. if(x1+x2 - min(a,b) <= 1e-9 && (x1+x2+c1.r2 + c2.r2)*(x1+x2+c1.r2+c2.r2) - (a*a+b*b) <= 1e-9){
  25. cout <<"YES"    << endl;
  26. return 0;
  27. }
  28. cout << "NO" << endl;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement