Guest User

Untitled

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