diff --git a/8.10/A - é—¨.cpp b/8.10/A - é—¨.cpp index a218885..1191cd3 100644 --- a/8.10/A - é—¨.cpp +++ b/8.10/A - é—¨.cpp @@ -1,50 +1,51 @@ -#include -#include -#include -#include +#include +#include +#include +#include using namespace std; -const double inf=1e100,EPS=1e-6; -const int W=20; -double l,now; +const double inf = 1e100, EPS = 1e-6; +const int W = 20; +double l, now; int n; struct wall { - double x,y[6],val[5]; + double x, y[6], val[5]; } w[W]; -//big bug:double->int -double length(double x1,double y1,double x2,double y2) +// big bug:double->int +double length(double x1, double y1, double x2, double y2) { - double x=x1-x2,y=y1-y2; - return sqrt(x*x+y*y); + double x = x1 - x2, y = y1 - y2; + return sqrt(x * x + y * y); } -double cross(double x1,double y1,double x2,double y2) +double cross(double x1, double y1, double x2, double y2) { - return x1*y2-x2*y1; + return x1 * y2 - x2 * y1; } -double same(double x0,double y0,double x3,double y3,double x1,double y1,double x2,double y2) +double same(double x0, double y0, double x3, double y3, double x1, double y1, double x2, double y2) { - double x=x3-x0,y=y3-y0;//y0->x0 - return cross(x,y,x1-x0,y1-y0)*cross(x,y,x2-x0,y2-y0); + double x = x3 - x0, y = y3 - y0; // y0->x0 + return cross(x, y, x1 - x0, y1 - y0) * cross(x, y, x2 - x0, y2 - y0); } -//WA double ÅжÏÕý¸ºÒªÓà +// WA double ÅжÏÕý¸ºÒªÓà int sign(double d) { - if(fabs(d)0? 1:-1; + else + return d > 0 ? 1 : -1; } -bool ob(int li,int lj,int ri,int rj) +bool ob(int li, int lj, int ri, int rj) { - for(int i=li+1; i>w[i].x; - for(int j=1; j<=4; j++)// ÓÖÊÇj + scanf("%lf", &w[i].x); + // cin>>w[i].x; + for (int j = 1; j <= 4; j++) // ÓÖÊÇj { - scanf("%lf",&w[i].y[j]); -// cin>>w[i].y[j]; + scanf("%lf", &w[i].y[j]); + // cin>>w[i].y[j]; } } - w[++n].x=10; - w[n].y[1]=5; - w[n].val[1]=inf;// bug û¸³Öµ + w[++n].x = 10; + w[n].y[1] = 5; + w[n].val[1] = inf; // bug û¸³Öµ doit(); - printf("%.2lf\n",w[n].val[1]); + printf("%.2lf\n", w[n].val[1]); } - return 0; + return 0; }