A10134 | Cut Length
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Given simple (without self-intersections) $n$ -gon. It is not necessary convex. Also you are given $m$ lines. For each line find the length of common part of the line and the $n$ -gon.
The boundary of $n$ -gon belongs to polygon. It is possible that $n$ -gon contains 180-degree angles.
The boundary of $n$ -gon belongs to polygon. It is possible that $n$ -gon contains 180-degree angles.
输入格式
The first line contains integers $n$ and $m$ ( $3<=n<=1000;1<=m<=100$ ). The following $n$ lines contain coordinates of polygon vertices (in clockwise or counterclockwise direction). All vertices are distinct.
The following $m$ lines contain line descriptions. Each of them contains two distict points of a line by their coordinates.
All given in the input coordinates are real numbers, given with at most two digits after decimal point. They do not exceed $10^{5}$ by absolute values.
The following $m$ lines contain line descriptions. Each of them contains two distict points of a line by their coordinates.
All given in the input coordinates are real numbers, given with at most two digits after decimal point. They do not exceed $10^{5}$ by absolute values.
输出格式
Print $m$ lines, the $i$ -th line should contain the length of common part of the given $n$ -gon and the $i$ -th line. The answer will be considered correct if the absolute or relative error doesn't exceed $10^{-6}$ .
输入输出样例
输入 #1
4 3 0 0 1 0 1 1 0 1 0 0 1 1 0 0 0 1 0 0 1 -1
输出 #1
1.41421356237309514547 1.00000000000000000000 0.00000000000000000000
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted