poj 1269

#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <queue>
#include <map>
#include <vector>
#include <set>
#include <string>
#include <math.h>
#define ll long long
using namespace std;
const int maxn=1e6+10;
const double EXP=1e-9;
struct point  { ll x,y;};
struct segment{ point a,b; }pa[maxn];
struct line   { point a,b; line(point x,point y){ a=x,b=y; };   };;
int main()
{
    int T;scanf("%d",&T);
    printf("INTERSECTING LINES OUTPUT
");
    while(T--)
    {
        point a,b,c,d;
        scanf("%lld %lld %lld %lld",&a.x,&a.y,&b.x,&b.y);
        scanf("%lld %lld %lld %lld",&c.x,&c.y,&d.x,&d.y);
        ll A1=b.y-a.y,B1=-(b.x-a.x),C1=b.y*a.x-b.x*a.y;
        ll A2=d.y-c.y,B2=-(d.x-c.x),C2=d.y*c.x-d.x*c.y;
        ll k=A1*B2-A2*B1;
        if(k==0)
        {
            if( C2*A1-C1*A2==0 && B1*C2-C1*B2==0 ) printf("LINE
");
            else                   printf("NONE
");
        }
        else
        {
            double x=-(B1*C2-C1*B2)*1.000000000/k;
            double y=(A1*C2-C1*A2)*1.00000000/k;
            printf("POINT %.2f %.2f
",x,y);
        }
    }
    printf("END OF OUTPUT
");
    return 0;
}
原文地址:https://www.cnblogs.com/Andromeda-Galaxy/p/10446804.html