编程介的小学生 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
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图