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

Grid Point Counting

Time Limit: 14000/7000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 653    Accepted Submission(s): 117


Problem Description
You have a number of sticks, which are thin enough to be considered as segments on the XY plane.

Your task is simple: count the number of grid points that are covered by at least one segment.
 

Input
The first line contains a single integer T (T <= 10), the number of test cases.
Each case begins with an integer n (1 <= n <= 500), the number of segments.
Each of the following n lines contains four real numbers x1, y1, x2, y2, denoting a segment (x1,y1)-(x2,y2).
All of x1, y1, x2, y2 will be no larger than 10000 in their absolute values, and will contain at most 4 digits after decimal point.
 

Output
For each test case, print the case number and the number of grid points.
 

Sample Input
2 2 -1 0 1 0 0 1 0 -1 1 1 2 3 4.0001
 

Sample Output
Case 1: 5 Case 2: 1
 

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-19 11:58:52, Gzip enabled