Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cmath>
- #include <iostream>
- #include <algorithm>
- using namespace std;
- const double PI = 3.14159265;
- struct cone{ double r1,r2; };
- inline double countx(const double &R1,const double &R2,const double &H,const double &D){
- if(H<=D) return R2;
- return (R1*(H-D) + R2*D)/H;
- }
- int main(){
- double a,b,d,h;
- cin >> a >> b >> d;
- cone c1, c2;
- cin >> c1.r1 >> c1.r2; cin >> c2.r1 >> c2.r2;
- cin >> h;
- double x1 = countx(c1.r1,c1.r2,h,d);
- double x2 = countx(c2.r1,c2.r2,h,d);
- 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){
- cout <<"YES" << endl;
- return 0;
- }
- cout << "NO" << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement