zoukankan      html  css  js  c++  java
  • 2017 ACMICPC Asia Regional Qingdao Online 1001 Apple

    Time Limit: 1000/1000 MS(Java/Others)    Memory Limit: 65535/32768 K (Java/Others)
    Total Submission(s): 0    Accepted Submission(s): 0


    Problem Description

    Apple is Taotao's favouritefruit. In his backyard, there are three apple trees with coordinates (x1,y1), (x2,y2), and (x3,y3). Now Taotao is planning toplant a new one, but he is not willing to take these trees too close. Hebelieves that the new apple tree should be outside the circle which the threeapple trees that already exist is on. Taotao picked a potential position (x,y) of the new tree. Couldyou tell him if it is outside the circle or not?

    Input

    The first line contains aninteger T, indicating that there are T(T≤30) cases.
    In the first line of each case, there are eight integers x1,y1,x2,y2,x3,y3,x,y, as described above.
    The absolute values of integers in input are less than or equal to 1,000,000,000,000.
    It is guaranteed that, any three of the four positions do not lie on a straightline.

    Output

    For each case, output"Accepted" if the position is outside the circle, or"Rejected" if the position is on or inside the circle.

    Sample Input

    3
    -2 0 0 -2 2 0 2 -2
    -2 0 0 -2 2 0 0 2
    -2 0 0 -2 2 0 1 1

    Sample Output

    Accepted
    Rejected
    Rejected

    最终代码还是wa

    #include <iostream>
    #include <cmath>
    #include <cstdio>
    using namespace std;
    typedef long long ll;
    int main()
    {
        int T;
        scanf("%d",&T);
        while(T--)
        {
            double x1,y1,x[5],y[5];
    
            double a,b,r;
            int i;
            for(i=1;i<=3;i++)
                scanf("%lf%lf",&x[i],&y[i]);
            scanf("%lf%lf",&x1,&y1);
            a = (x[2]*x[2]*y[1]-x[3]*x[3]*y[1]-x[1]*x[1]*y[2]+x[3]*x[3]*y[2]-y[1]*y[1]*y[2]+y[1]*y[2]*y[2]+x[1]*x[1]*y[3]-x[2]*x[2]*y[3]+y[1]*y[1]*y[3]-y[2]*y[2]*y[3]-y[1]*y[3]*y[3]+y[2]*y[3]*y[3])/(2* (x[2]* y[1] - x[3] *y[1] - x[1]* y[2] + x[3]* y[2] + x[1]* y[3] - x[2]* y[3]));
            b = -(-x[1]*x[1]* x[2] + x[1]*x[2]*x[2] + x[1]*x[1] *x[3] - x[2]*x[2]* x[3] - x[1]* x[3]*x[3] + x[2]*  x[3]*x[3] - x[2] *y[1]*y[1] + x[3] *y[1]*y[1] + x[1] *y[2]*y[2] - x[3] *y[2]*y[2] - x[1]* y[3]*y[3] + x[2]* y[3]*y[3])/(2 *(x[2] *y[1] - x[3]* y[1] - x[1] *y[2] + x[3] *y[2] + x[1] *y[3] - x[2]* y[3]));
            r = sqrt((x[1]-a)*(x[1]-a) + (y[1]-b)*(y[1]-b));
            //printf("%lf %lf %lf
    ",a,b,r);
            double t = sqrt((x1-a)*(x1-a) + (y1-b)*(y1-b));
            if(t>r)
                printf("Accepted
    ");
            else
                printf("Rejected
    ");
        }
        return 0;
    }
    


  • 相关阅读:
    ASP.NET MVC 3 (Intro to ASP.NET MVC 3) (1/9)
    ASP.NET MVC 3 (Implementing Edit, Details, and Delete Views) (9/9)
    遍历Request.ServerVariables
    类似QQ邮箱中‘HTML方式查看’功能查看Office文件
    ASP.NET MVC 3 (Accessing your Model's Data from a Controller) (5/9)
    无法解析或打开软件包的列表或是状态文件
    初始化二维指针
    Linux练习(产生临时文件)
    [zz]c++可变参数函数使用
    git使用方法
  • 原文地址:https://www.cnblogs.com/sxy201658506207/p/7586261.html
Copyright © 2011-2022 走看看