hdu3685
来源:互联网 发布:万兆网络交换机 编辑:程序博客网 时间:2024/05/16 07:04
Rotational Painting
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 683 Accepted Submission(s): 184
Problem Description
Josh Lyman is a gifted painter. One of his great works is a glass painting. He creates some well-designed lines on one side of a thick and polygonal glass, and renders it by some special dyes. The most fantastic thing is that it can generate different meaningful paintings by rotating the glass. This method of design is called “Rotational Painting (RP)” which is created by Josh himself.
You are a fan of Josh and you bought this glass at the astronomical sum of money. Since the glass is thick enough to put erectly on the table, you want to know in total how many ways you can put it so that you can enjoy as many as possible different paintings hiding on the glass. We assume that material of the glass is uniformly distributed. If you can put it erectly and stably in any ways on the table, you can enjoy it.
More specifically, if the polygonal glass is like the polygon in Figure 1, you have just two ways to put it on the table, since all the other ways are not stable. However, the glass like the polygon in Figure 2 has three ways to be appreciated.
Pay attention to the cases in Figure 3. We consider that those glasses are not stable.
You are a fan of Josh and you bought this glass at the astronomical sum of money. Since the glass is thick enough to put erectly on the table, you want to know in total how many ways you can put it so that you can enjoy as many as possible different paintings hiding on the glass. We assume that material of the glass is uniformly distributed. If you can put it erectly and stably in any ways on the table, you can enjoy it.
More specifically, if the polygonal glass is like the polygon in Figure 1, you have just two ways to put it on the table, since all the other ways are not stable. However, the glass like the polygon in Figure 2 has three ways to be appreciated.
Pay attention to the cases in Figure 3. We consider that those glasses are not stable.
Input
The input file contains several test cases. The first line of the file contains an integer T representing the number of test cases.
For each test case, the first line is an integer n representing the number of lines of the polygon. (3<=n<=50000). Then n lines follow. The ith line contains two real number xi and yi representing a point of the polygon. (xi, yi) to (xi+1, yi+1) represents a edge of the polygon (1<=i<n), and (xn,yn) to (x1, y1) also represents a edge of the polygon. The input data insures that the polygon is not self-crossed.
For each test case, the first line is an integer n representing the number of lines of the polygon. (3<=n<=50000). Then n lines follow. The ith line contains two real number xi and yi representing a point of the polygon. (xi, yi) to (xi+1, yi+1) represents a edge of the polygon (1<=i<n), and (xn,yn) to (x1, y1) also represents a edge of the polygon. The input data insures that the polygon is not self-crossed.
Output
For each test case, output a single integer number in a line representing the number of ways to put the polygonal glass stably on the table.
Sample Input
240 0100 099 11 160 00 101 101 110 110 0
Sample Output
23HintThe sample test cases can be demonstrated by Figure 1 and Figure 2 in Description part.
Source
The 35th ACM-ICPC Asia Regional Contest (Hangzhou)
Recommend
lcy&zhengfeng
东拼西凑模版终于被哥A掉了。。
- hdu3685
- HDU3685计算几何
- HDU3685 RotationalPainting 计算几何 ACM2010杭州站
- HDU3685稳定多边形(求多边形重心+凸包)
- hdu3685(几何重心与凸包结合)
- 欧盟 物联网战略研究路线图 翻译稿 初稿 3
- 点点滴滴C
- Protel网络表常见错误及实用技巧
- maven编译项目时遇到的奇怪的错误
- 手工添加 eclipse project 识别文件
- hdu3685
- spring2.x + struts2.x + ibatis2.x maven pom
- 第二大数
- java服务器向flex客户端一对一推送数据
- 借shengli的问题,简单讲一下程序的编译过程
- php性能优化---本地缓存和常量
- Application的logo代替Tomcat的小猫咪logo
- WIFI之二:AdHoc网络,及WIFI驱动基础
- 分享一张vim的快捷键的图