2009-02-19 22:03:45來源不明
章魚教學網站-97學年度程設馬拉松賽 Linearity
#include<stdio.h>
#include<stdlib.h>
main()
{
int x1,x2,x3,y1,y2,y3;
int c,time=0;
scanf("%d",&c);
{
while(c--)
{
time++;
scanf("%d,%d %d,%d %d,%d",&x1,&y1,&x2,&y2,&x3,&y3);
if((x1-x2)*(y3-y1)==(x3-x1)*(y1-y2)||(x1==x2&&x1==x3&&y1==y2&&y1==y3))
printf("collinear\n");
else
printf("not collinear\n");
}
}
return 0;
}
#include<stdlib.h>
main()
{
int x1,x2,x3,y1,y2,y3;
int c,time=0;
scanf("%d",&c);
{
while(c--)
{
time++;
scanf("%d,%d %d,%d %d,%d",&x1,&y1,&x2,&y2,&x3,&y3);
if((x1-x2)*(y3-y1)==(x3-x1)*(y1-y2)||(x1==x2&&x1==x3&&y1==y2&&y1==y3))
printf("collinear\n");
else
printf("not collinear\n");
}
}
return 0;
}