Area Folding
来源:互联网 发布:淘宝寿衣门女主角人肉 编辑:程序博客网 时间:2024/05/21 09:29
题目描述:
B. Area Folding
Time Limit: 5000ms
Memory Limit: 65536KB
64-bit integer IO format: %lld Java class name: Main
Submit Status PID: 39564
Area Folding
You are given one polygonal line, which is a collection of line segments. Your task is to calculate the sum of areas enclosed by the polygonal line.
A point is defined to be “enclosed” if and only if the point is unreachable without crossing at least one line segment from the point at infinity.
Input
The first line contains one integers N (2 ≤ N ≤ 100). N is the number of segments.
Each of the following N lines consists of two integers Xi and Yi (-105 ≤ Xi, Yi ≤ 105, 1 ≤ i ≤ N) which represents a vertex. A polygonal line is the segments which connect (Xj, Yj) and (Xj+1, Yj+1) ((Xj, Yj) ≠ (Xj+1, Yj+1), 1 ≤ j ≤ N-1). The distance between a segment Sj and all vertices except the end points on segment Sj is guaranteed to be greater than 0.01.
Output
Output the answer in a line. The answer may be printed with an arbitrary number of decimal digits, but may not contain an absolute or relative error greater than or equal to 10-6.
Sample Input 1
5
0 0
1 1
1 0
0 1
0 0
Output for the Sample Input 1
0.5
Sample Input 2
5
0 0
1 1
1 0
0 1
1 0
Output for the Sample Input 2
0.25
Sample Input 3
21
1 1
-1 1
-1 2
-2 2
-2 1
-1 1
-1 -1
-2 -1
-2 -2
-1 -2
-1 -1
1 -1
1 -2
2 -2
2 -1
1 -1
1 1
2 1
2 2
1 2
1 1
Output for the Sample Input 3
8
Sample Input 4
16
0 0
1 0
1 1
0 1
0 2
0 3
1 3
1 2
2 2
2 3
3 3
3 2
3 1
2 1
2 0
3 0
Output for the Sample Input 4
0
Sample Input 5
7
26 52
33 12
-51 68
16 61
43 -26
87 24
12 10
Output for the Sample Input 5
2714.840579710
题解:
先占个坑
http://blog.csdn.net/UESTC_peterpan/article/details/48914561
http://blog.csdn.net/uestc_peterpan/article/details/48914527
重点:
代码:
- Area Folding
- Folding
- Folding@home
- poj2176 Folding
- Paper folding
- UVA1630 - Folding
- Folding Gym
- Word Folding
- 计蒜客 folding
- Folding UVA
- Area
- Area
- Area
- area
- Area
- Area
- UVa1630 Folding/poj 2176 Folding/zoj 1554 Folding
- ZOJ 1554 Folding
- phantomjs 的安装和使用
- HDU 1561 The more, The Better(树形DP入门)
- UIButton的ImageView 添加animation,动画执行完毕后变暗
- 理解 Java 的 GC 与 幽灵引用
- iOS数组去重总结
- Area Folding
- 推荐几款实用的Android Studio 插件
- Fragment使用学习(一)——基本使用信息
- 黑马程序员---成长之路-----OC之基础篇self关键字
- tomcat做集群管理
- 2015年10月09日——python环境
- POJ1785
- 近几年的论文和代码
- 查准率和查全率