|
||||||||||
Grid Point CountingTime 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
Sample Output
Source | ||||||||||
|