Hills

Time Limit: 10 Seconds
Memory Limit: 32768 KB

### THE 30th ACM/ICPC ASIA REGIONAL 2005 HANGZHOU SITE

#### Onsite Contest Session

## Problem H: Hills

Little Billy likes drawing with chalks of all colors. As a child of his age, all he can do is to draw straight lines. Today he has been told that hills are of the shape of triangles, and he brought out a lot of his works and tried to identify as many hills as he could. Being one of his best friends, you gladly joined his effort. However after working for a while you are desperate to find the huge number of sketches he has produced. You suggested this alternative plan �C to code up a program for him.

This sample figure only contains a single "hill"
Keep in mind that in Billy's pictures all the lines are connected, and no line will have an end point right on another line. We would only count the hills that are not cut by other lines.

**Input Description**

Standard input will contain multiple test cases. The first line of the input is a single integer T (1 <= T <= 10) which is the number of test cases. T test cases follow, each preceded by a single blank line.

Each test case starts with an integer N (1 < N <= 500), which is the number of lines on the picture. The next N lines contain a line segment's two end points. The coordinates are all integers (-10,000 < x, y < 10,000).

**Output Description**

Results should be directed to standard output. Start each case with "Case #:" on a single line, where # is the case number starting from 1. Two consecutive cases should be separated by a single blank line. No blank line should be produced after the last test case.

For each test case, print the number of hills on a single line.

**Sample Input**

3
3
-1 0 3 0
0 -1 0 3
-1 3 3 -1
4
-3 0 3 0
-3 -1 1 3
3 -1 -1 3
0 3 0 -1
6
-3 -2 3 -2
-2 -3 -2 3
-3 2 3 2
2 -3 2 3
-3 -3 3 3
1 -1 -1 1

**Sample Output**

Case 1:
1
Case 2:
2
Case 3:
0

Submit
Status