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

水题get,233题&&擠进3000名纪念!

Posted by KatrineYang at 2016-08-20 02:04:25 on Problem 1269 and last updated at 2016-08-20 02:05:29
#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:
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