10 6 13.5 4 10 6 14.5 4
yes no
#include<stdio.h> #include<math.h> double l,d,x,y; double ff(double n) { double x0,y0,c,s; s=sin(n); c=cos(n); x0=-1*(d/s+c*l); y0=(d/c+s*l); double tmp=(1.0-x/y0)*x0*(-1); return tmp; } int main() { double left,right,mid1,mid2,max; while(scanf("%lf%lf%lf%lf",&x,&y,&l,&d)!=EOF) { left=0; right=asin(1.0); max=0; while(fabs(right-left)>=0.000001) { mid1=(right+left)/2; mid2=(left+mid1)/2; if(ff(mid1)>ff(mid2)) { left=mid2; } else { right=mid1; } } double tmp=ff(left); if(tmp<y)printf("yes\n"); else printf("no\n"); } return 0; }
原文地址:http://blog.csdn.net/acm_baihuzi/article/details/41451471