| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
水题get,233题&&擠进3000名纪念!#include <iostream>
#include <stdio.h>
using namespace std;
int main() {
int cases;
scanf("%d", &cases);
printf("INTERSECTING LINES OUTPUT\n");
for(int ii = 0; ii < cases; ii++){
int x1,y1,x2,y2,x3,y3,x4,y4;
scanf("%d%d%d%d%d%d%d%d", &x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
int fm = -(y1-y2)*(x3-x4)+(y3-y4)*(x1-x2);
if(fm == 0){
if(x2*y3+x3*y1+x1*y2-x2*y1-x3*y2-x1*y3 == 0){
printf("LINE\n");
}
else{
printf("NONE\n");
}
}
else{
int xfz = -(x2*y1-x1*y2)*(x3-x4)+(x4*y3-x3*y4)*(x1-x2);
int yfz = (y1-y2)*(x4*y3-x3*y4)-(y3-y4)*(x2*y1-x1*y2);
double x = xfz * 1.0 / fm, y = yfz * 1.0 / fm;
printf("POINT %.2lf %.2lf\n", x, y);
}
}
printf("END OF OUTPUT\n");
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator