Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

麻烦大牛帮忙看一下,谢谢啦!

Posted by hustpd2 at 2009-06-01 03:07:17 on Problem 1269
#include<stdio.h>
void judge(double x1,double y1,double x2,double y2,double x3,double y3,double x4,double y4)
{
     double a1,a2,b1,b2,c1,c2;
     a1=y2-y1,b1=x1-x2,c1=x1*(y2-y1)-y1*(x2-x1);
     a2=y4-y3,b2=x3-x4,c2=x3*(y4-y3)-y3*(x4-x3);
     if(a1*b2==a2*b1)
     {
                 if(a1*c2==a2*c1&&b1*c2==b2*c1)
                 printf("LINE\n");
                 else
                 printf("NONE\n");
     }
     else 
     printf("POINT %.2f %.2f\n",(c1*b2-c2*b1)/(a1*b2-a2*b1),(c1*a2-c2*a1)/(a2*b1-a1*b2));
}        

int main()
{
    double x1,x2,x3,x4,y1,y2,y3,y4;
    int m,i;
    scanf("%d",&m);
    puts("INTERSECTING LINES OUTPUT");
    printf("\n");
    for(i=0;i<m;i++)
    {
                    scanf("%f %f %f %f %f %f %f %f",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
                    judge(x1,y1,x2,y2,x3,y3,x4,y4);
    }
    printf("END OF OUTPUT\n");
    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator