编程介的小学生 2017-10-29 07:41 采纳率: 20.5%
浏览 675
已采纳

Infinity Point Sets

Problem Description
This story comes from an ancient book written by an old frog philosopher.

When will be the end of the world? Perhaps the best way to understand is using geometry for a calculation.

At first, you should draw some points on a piece of paper. Each time you should choose two points and connect them with a segment. When there are two segments meet and produce a new point at the cross, you add that point to the paper, and try to connect it with previous ones as before.

You should do this again and again, keep drawing segments, and adding points if possible, until there are no new segments to draw. Then is the end of the world, the old frogs will die and a new age will begin.

As you can see, different sets of initial points lead to different results. For some sets of points, the end of the world will never come, we call those sets Infinity.

Now you are given N points, and you need to find, among all the possible subsets of those N points not including empty set, so there will be 2N−1 sets in total), how many of them are not Infinity?

Input
First line contains an integer T, which indicates the number of test cases.

Every test case begins with an integers N, which indicates the numbers of points.

In the following N lines, the ith line contains two intergers xi and yi, indicating the coordinate of ith point is (xi,yi).

⋅ 1≤T≤10.

⋅ for 90% data, 1≤N≤100.

⋅ for 100% data, 1≤N≤1000.

⋅ 1≤xi,yi≤104.

⋅ there is no a pair of points with the same coordinate.

Output
For every test case, you should output `"Case #x: y", where x indicates the case number and counts from 1 and y is the result.

Because y could be very large, just mod it with 109+7.

Sample Input
2
4
0 0
0 2
2 2
2 0
5
0 0
0 2
2 2
2 0
1 2

Sample Output
Case #1: 15
Case #2: 30

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-11-18 15:42
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器