题库练习 Polygon for the Angle
← 上一题 下一题 →

A12339 | Polygon for the Angle

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

You are given an angle $\text{ang}$ .

The Jury asks You to find such regular $n$ -gon (regular polygon with $n$ vertices) that it has three vertices $a$ , $b$ and $c$ (they can be non-consecutive) with $\angle{abc} = \text{ang}$ or report that there is no such $n$ -gon.

![](/uploads/acgo/image/5875c97b9501a624_9723536dd52c.jpeg)If there are several answers, print the minimal one. It is guarantied that if answer exists then it doesn't exceed $998244353$ .

输入格式

The first line contains single integer $T$ ( $1 \le T \le 180$ ) — the number of queries.

Each of the next $T$ lines contains one integer $\text{ang}$ ( $1 \le \text{ang} < 180$ ) — the angle measured in degrees.

输出格式

For each query print single integer $n$ ( $3 \le n \le 998244353$ ) — minimal possible number of vertices in the regular $n$ -gon or $-1$ if there is no such $n$ .

输入输出样例

输入 #1
4
54
50
2
178
输出 #1
10
18
90
180
C++ 编辑器
输入
输出