A11002 | Mister B and Angle in Polygon
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
On one quiet day all of sudden Mister B decided to draw angle $a$ on his field. Aliens have already visited his field and left many different geometric figures on it. One of the figures is regular convex $n$ -gon (regular convex polygon with $n$ sides).
That's why Mister B decided to use this polygon. Now Mister B must find three distinct vertices $v_{1}$ , $v_{2}$ , $v_{3}$ such that the angle  (where $v_{2}$ is the vertex of the angle, and $v_{1}$ and $v_{3}$ lie on its sides) is as close as possible to $a$ . In other words, the value  should be minimum possible.
If there are many optimal solutions, Mister B should be satisfied with any of them.
That's why Mister B decided to use this polygon. Now Mister B must find three distinct vertices $v_{1}$ , $v_{2}$ , $v_{3}$ such that the angle  (where $v_{2}$ is the vertex of the angle, and $v_{1}$ and $v_{3}$ lie on its sides) is as close as possible to $a$ . In other words, the value  should be minimum possible.
If there are many optimal solutions, Mister B should be satisfied with any of them.
输入格式
First and only line contains two space-separated integers $n$ and $a$ ( $3<=n<=10^{5}$ , $1<=a<=180$ ) — the number of vertices in the polygon and the needed angle, in degrees.
输出格式
Print three space-separated integers: the vertices $v_{1}$ , $v_{2}$ , $v_{3}$ , which form . If there are multiple optimal solutions, print any of them. The vertices are numbered from $1$ to $n$ in clockwise order.
输入输出样例
输入 #1
3 15
输出 #1
1 2 3
输入 #2
4 67
输出 #2
2 1 3
输入 #3
4 68
输出 #3
4 1 2
In first sample test vertices of regular triangle can create only angle of $60$ degrees, that's why every possible angle is correct.
Vertices of square can create $45$ or $90$ degrees angles only. That's why in second sample test the angle of $45$ degrees was chosen, since $|45-67|<|90-67|$ . Other correct answers are: "3 1 2", "3 2 4", "4 2 3", "4 3 1", "1 3 4", "1 4 2", "2 4 1", "4 1 3", "3 1 4", "3 4 2", "2 4 3", "2 3 1", "1 3 2", "1 2 4", "4 2 1".
In third sample test, on the contrary, the angle of $90$ degrees was chosen, since $|90-68|<|45-68|$ . Other correct answers are: "2 1 4", "3 2 1", "1 2 3", "4 3 2", "2 3 4", "1 4 3", "3 4 1".
Vertices of square can create $45$ or $90$ degrees angles only. That's why in second sample test the angle of $45$ degrees was chosen, since $|45-67|<|90-67|$ . Other correct answers are: "3 1 2", "3 2 4", "4 2 3", "4 3 1", "1 3 4", "1 4 2", "2 4 1", "4 1 3", "3 1 4", "3 4 2", "2 4 3", "2 3 1", "1 3 2", "1 2 4", "4 2 1".
In third sample test, on the contrary, the angle of $90$ degrees was chosen, since $|90-68|<|45-68|$ . Other correct answers are: "2 1 4", "3 2 1", "1 2 3", "4 3 2", "2 3 4", "1 4 3", "3 4 1".
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted