2015
04-13

# Counting Grids

Small Ming is a lazy middle school student, one day, when he’s doing his physics experiment, the teacher wants them to estimate the size of the molecule by Film Method(You Mo Fa). As is known to all, the experiment requires students to draw the outline of the Film(You MO). But Ming is so lazy that he doesn’t want to draw the outline precisely. So he chooses some points on the grid plane whose coordinates are integers, and promise that , after connecting these points with segments in clock-wise, you can get a convex polygon P which contains the whole Film(You Mo). Lazy Ming wants to use polygon P represented the Film to complete his experiment. But for some reasons, he forgot the points he choose on the second day.The only thing he remeber is some points with integer coordinates on the Film(You Mo) that can perfectly describe the polygon P.Now as a TopCoder and a good friend of him, can you help him to calculate the number of grids on the Film(You Mo)?

Mutilple cases. For every case, first line is an integer N(N<10^5), then N lines follow. Each line has 2 integers x and y, which describe a point on the grid plane(0<=x,y<=10^5).

Mutilple cases. For every case, first line is an integer N(N<10^5), then N lines follow. Each line has 2 integers x and y, which describe a point on the grid plane(0<=x,y<=10^5).

3
0 0
0 1
1 1

1

1. 我还有个问题想请教一下，就是感觉对于新手来说，递归理解起来有些困难，不知有没有什么好的方法或者什么好的建议？

2. 约瑟夫也用说这么长……很成熟的一个问题了，分治的方法解起来o(n)就可以了，有兴趣可以看看具体数学的第一章，关于约瑟夫问题推导出了一系列的结论，很漂亮