CF1096C.Polygon for the Angle
普及/提高-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given an angle 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 ∠abc=ang or report that there is no such n-gon.

If there are several answers, print the minimal one. It is guarantied that if answer exists then it doesn't exceed 998244353.
给你一个角度 ang。
评测组要求你找出一个正 n 边形(具有 n 个顶点的正多边形),使得该正 n 边形中存在三个顶点 a、b 和 c(它们不必相邻),满足 ∠abc=ang;若不存在这样的正 n 边形,则报告无解。

若存在多个解,请输出最小的 n。题目保证:若解存在,则其值不超过 998244353。
输入格式
The first line contains single integer T (1≤T≤180) — the number of queries.
Each of the next T lines contains one integer ang (1≤ang<180) — the angle measured in degrees.
第一行包含一个整数 T(1≤T≤180)—— 查询次数。
接下来的 T 行,每行包含一个整数 ang(1≤ang<180)—— 以度为单位测量的角度。
输出格式
For each query print single integer n (3≤n≤998244353) — minimal possible number of vertices in the regular n-gon or −1 if there is no such n.
对于每个查询,输出一个整数 n(3≤n≤998244353)——即满足条件的正 n 边形的最少顶点数;若不存在这样的 n,则输出 −1。
输入输出样例
输入#1
4 54 50 2 178
输出#1
10 18 90 180
说明/提示
The answer for the first query is on the picture above.
The answer for the second query is reached on a regular 18-gon. For example, ∠v2v1v6=50∘.
The example angle for the third query is ∠v11v10v12=2∘.
In the fourth query, minimal possible n is 180 (not 90).
第一个查询的答案如上图所示。
第二个查询的答案在一个正 18 边形中达到。例如,∠v2v1v6=50∘。
第三个查询的示例角度为 ∠v11v10v12=2∘。
在第四个查询中,最小可能的 n 是 180(而非 90)。
输入解题思路,AI测评打分。不知道怎么写?