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

Life is a Line

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others)
Total Submission(s): 2319    Accepted Submission(s): 590


Problem Description
There is a saying: Life is like a line, some people are your parallel lines, while others are destined to meet you.
Maybe have met, maybe just a matter of time, two unparallel lines will always meet in some places, and now a lot of life (i.e. line) are in the same coordinate system, in a given open interval, how many pairs can meet each other?

 

Input
There are several test cases in the input.

Each test case begin with one integer N (1 ¡Ü N ¡Ü 50000), indicating the number of different lines.
Then two floating numbers L, R follow (-10000.00 ¡Ü L < R ¡Ü 10000.00), indicating the interval (L, R).
Then N lines follow, each line contains four floating numbers x1, y1, x2, y2 (-10000.00 ¡Ü x1, y1, x2, y2 ¡Ü 10000.00), indicating two different points on the line. You can assume no two lines are the same one.

The input terminates by end of file marker.
 

Output
For each test case, output one integer, indicating pairs of intersected lines in the open interval, i.e. their intersection point¡¯s x-axis is in (l, r).

 

Sample Input
3 0.0 1.0 0.0 0.0 1.0 1.0 0.0 2.0 1.0 2.0 0.0 2.5 2.5 0.0
 

Sample Output
1
 

Author
iSea @ WHU
 

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-05-05 16:22:26, Gzip enabled