F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

gxx's Problem

Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 689    Accepted Submission(s): 156


Problem Description
  In ACM_DIY, there is a master called ¡°gxx¡±. Whenever someone asks a problem, he will come out with the Source (such as ¡°in ** OJ, the ID to this problem is **¡±), then say ¡°The Problem is ShaX¡­¡­Isn¡¯t it a problem that you should kill in a second? ¡­¡­¡± or something like that. One day, one giantarum called ac wants to ask something about the common point(s) of two given ¡°Segments¡±. Each segment is described as two points in 2D.
  Of course, gxx says: ¡°It¡¯s a problem that could be killed in one second!¡± However, the giantarum ac does not know how to solve this problem, could you help him?
 

Input
  The first line contains one integer T, indicates the number of the test cases. (T <= 100)
  Then every case has two lines. Each line has four integer numbers x0 y0 x1 y1, indicates the two end-points of the segment. (0<=|x0|, |y0|, |x1|, |y1| <= 10^6)
  All the test cases are seperated by a single blank line.
 

Output
Output one integer M in a single line, indicates the number of common point(s) of the two given segment.
Then M lines, each line has two fractions in lowest term indicate the common point.
(Of course, if the denominator is one, then you should ignore it!)
Obviously, if lots of points could be found, just output one line ¡°INF¡±.
 

Sample Input
5 0 0 1 1 1 0 0 1 0 0 1 0 1 1 2 2 0 0 -1 -1 -1 0 0 -1 0 0 2 2 2 2 4 0 0 0 1 1 0 0 1 1
 

Sample Output
1 1/2 1/2 0 1 -1/2 -1/2 1 2 2 INF
 

Author
AekdyCoin
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-26 21:28:42, Gzip enabled