NOJ1068 烦恼的中学生

#include<stdio.h>
double fuckyou(double m)
{
    if ((m <= 0.001) && (m >= -0.001))
        return 0;
    else
        return m;
}
int main()
{
    int c;
    double x1, y1, x2, y2, x3, y3, x, y;
    scanf("%d", &c);
    while (c--)
    {
        scanf("%lf %lf",&x1, &y1);
        scanf("%lf %lf",&x2, &y2);
        scanf("%lf %lf",&x3, &y3);
        x = -(x1 * x2 * y1 - x1 * x3 * y1 - x1 * x2 * y2 + x2 * x3 * y2 + y1 * y1 * y2 - y1 * y2 * y2 + x1 * x3 * y3 - x2 * x3 * y3 - y1 * y1 * y3 + y2 * y2 * y3 + y1 * y3 * y3 - y2 * y3 * y3) / (-x2 * y1 + x3 * y1 + x1 * y2 - x3 * y2 - x1 * y3 + x2 * y3);
        y = -(x1 * x1 * x2 - x1 * x2 * x2 - x1 * x1 * x3 + x2 * x2 * x3 + x1 * x3 * x3 - x2 * x3 * x3 + x1 * y1 * y2 - x2 * y1 * y2 - x1 * y1 * y3 + x3 * y1 * y3 + x2 * y2 * y3 - x3 * y2 * y3) / (x2 * y1 - x3 * y1 - x1 * y2 + x3 * y2 + x1 * y3 - x2 * y3);
        x = fuckyou(x);
        y = fuckyou(y);
        printf("%.3f %.3f\n", x, y);
    }
    return 0;
}

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注