Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
是阿,我是通过辐角判断的,莫名其妙就一堆waIn Reply To:cmft~ Posted by:frkstyc at 2005-05-09 21:07:45 #include <stdio.h> #include <math.h> #define PI 3.1415926535 void main() { long t,r,x1,x2,x3,y1,y2,y3; double q1,q2,q3,qmax,qmin,qmid; scanf("%ld",&t); while (t--) { scanf("%ld%ld%ld%ld%ld%ld%ld",&r,&x1,&y1,&x2,&y2,&x3,&y3); if (x1*y2==x2*y1 || x1*y3==x3*y1 || x2*y3==x3*y2) { printf("No\n");continue; } if (y1>=0) q1=acos(double(x1)/sqrt(double(x1*x1+y1*y1))); else q1=2*PI-acos(double(x1)/sqrt(double(x1*x1+y1*y1))); if (y2>=0) q2=acos(double(x2)/sqrt(double(x2*x2+y2*y2))); else q2=2*PI-acos(double(x2)/sqrt(double(x2*x2+y2*y2))); if (y3>=0) q3=acos(double(x3)/sqrt(double(x3*x3+y3*y3))); else q3=2*PI-acos(double(x3)/sqrt(double(x3*x3+y3*y3))); qmax=-1.0;qmin=3*PI; if (q1>qmax) qmax=q1;if (q1<qmin) qmin=q1; if (q2>qmax) qmax=q2;if (q2<qmin) qmin=q2; if (q3>qmax) qmax=q3;if (q3<qmin) qmin=q3; if (qmax-qmin<PI/1.5+1e-10) printf("No\n"); else { if (q1<qmax-1e-10 && q1>qmin+1e-10) qmid=q1; if (q2<qmax-1e-10 && q2>qmin+1e-10) qmid=q2; if (q3<qmax-1e-10 && q3>qmin+1e-10) qmid=q3; if (qmid-qmin>PI/0.75-1e-10 || qmax-qmid>PI/0.75-1e-10) printf("No\n"); else printf("Yes\n"); } } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator