Demo entry 6641244

1

   

Submitted by anonymous on Sep 17, 2017 at 08:45
Language: C++. Code size: 851 Bytes.

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;

double x[5],y[5];

 void cal()
 {
     double a1 = x[1] - x[0], b1 = y[1]- y[0], c1 = (a1 * a1 + b1 * b1) / 2.0;
     double a2 = x[2] - x[0], b2 = y[2] - y[0], c2 = (a2 * a2 + b2 * b2) / 2.0;
     double d = a1 * b2 - a2 * b1;
     x[4] = x[0] + (c1*b2 - c2*b1)/d , y[4] = y[0] + (a1*c2 - a2*c1)/d;
 }

 double dis(int a,int b)
 {
     return (x[a] - x[b])*(x[a] - x[b]) + (y[a] - y[b])*(y[a] - y[b]);
 }

 int main()
 {
     //freopen("test.txt","r",stdin);
     int T;
     scanf("%d", &T);
     while (T--)
     {
         for (int i = 0; i < 4; ++i)
             scanf("%lf %lf", x + i, y + i);
         cal();
         if(dis(3,4) > dis(0,4))
             puts("Accepted");
         else
             puts("Rejected");
     }
     return 0;
}

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).