编程介的小学生 2017-09-16 13:48 采纳率: 20.5%
浏览 659
已采纳

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

  • 写回答

1条回答

  • threenewbee 2017-09-30 13:39
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗
  • ¥15 钢筋实图交点识别,机器视觉代码
  • ¥15 如何在Linux系统中,但是在window系统上idea里面可以正常运行?(相关搜索:jar包)
  • ¥50 400g qsfp 光模块iphy方案
  • ¥15 两块ADC0804用proteus仿真时,出现异常
  • ¥15 关于风控系统,如何去选择
  • ¥15 这款软件是什么?需要能满足我的需求
  • ¥15 SpringSecurityOauth2登陆前后request不一致
  • ¥15 禅道二次开发编辑版本,上传不了发行包