A7984 | Inquisition
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
In Medieval times existed the tradition of burning witches at steaks together with their pets, black cats. By the end of the 15-th century the population of black cats ceased to exist. The difficulty of the situation led to creating the EIC - the Emergency Inquisitory Commission.
The resolution #666 says that a white cat is considered black when and only when the perimeter of its black spots exceeds the acceptable norm. But what does the acceptable norm equal to? Every inquisitor will choose it himself depending on the situation. And your task is to find the perimeter of black spots on the cat's fur.
The very same resolution says that the cat's fur is a white square with the length of $10^{5}$ . During the measurement of spots it is customary to put the lower left corner of the fur into the origin of axes $(0;0)$ and the upper right one — to the point with coordinates $(10^{5};10^{5})$ . The cats' spots are nondegenerate triangles. The spots can intersect and overlap with each other, but it is guaranteed that each pair of the triangular spots' sides have no more than one common point.
We'll regard the perimeter in this problem as the total length of the boarders where a cat's fur changes color.
The resolution #666 says that a white cat is considered black when and only when the perimeter of its black spots exceeds the acceptable norm. But what does the acceptable norm equal to? Every inquisitor will choose it himself depending on the situation. And your task is to find the perimeter of black spots on the cat's fur.
The very same resolution says that the cat's fur is a white square with the length of $10^{5}$ . During the measurement of spots it is customary to put the lower left corner of the fur into the origin of axes $(0;0)$ and the upper right one — to the point with coordinates $(10^{5};10^{5})$ . The cats' spots are nondegenerate triangles. The spots can intersect and overlap with each other, but it is guaranteed that each pair of the triangular spots' sides have no more than one common point.
We'll regard the perimeter in this problem as the total length of the boarders where a cat's fur changes color.
输入格式
The first input line contains a single integer $n$ ( $0<=n<=100$ ). It is the number of spots on the cat's fur. The $i$ -th of the last $n$ lines contains $6$ integers: $x_{1i}$ , $y_{1i}$ , $x_{2i}$ , $y_{2i}$ , $x_{3i}$ , $y_{3i}$ . They are the coordinates of the $i$ -th triangular spot $(0<x_{ji},y_{ji}<10^{5})$ .
输出格式
Print a single number, the answer to the problem, perimeter of the union of triangles. Your answer should differ from the correct one in no more than $10^{-6}$ .
输入输出样例
输入 #1
1 1 1 2 1 1 2
输出 #1
3.4142135624
输入 #2
3 3 3 10 3 3 10 1 1 9 4 5 6 2 2 11 7 6 11
输出 #2
37.7044021497
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted