CF1096C.Polygon for the Angle

普及/提高-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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

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

If there are several answers, print the minimal one. It is guarantied that if answer exists then it doesn't exceed 998244353998244353.

给你一个角度 ang\text{ang}。

评测组要求你找出一个正 nn 边形(具有 nn 个顶点的正多边形),使得该正 nn 边形中存在三个顶点 aa、bb 和 cc(它们不必相邻),满足 ∠abc=ang\angle{abc} = \text{ang};若不存在这样的正 nn 边形,则报告无解。

若存在多个解,请输出最小的 nn。题目保证:若解存在,则其值不超过 998244353998244353。

输入格式

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

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

第一行包含一个整数 TT(1≤T≤1801 \le T \le 180)—— 查询次数。

接下来的 TT 行,每行包含一个整数 ang\text{ang}(1≤ang<1801 \le \text{ang} \lt 180)—— 以度为单位测量的角度。

输出格式

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

对于每个查询,输出一个整数 nn(3≤n≤9982443533 \le n \le 998244353)——即满足条件的正 nn 边形的最少顶点数;若不存在这样的 nn,则输出 −1-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 1818-gon. For example, ∠v2v1v6=50∘\angle{v_2 v_1 v_6} = 50^{\circ}.

The example angle for the third query is ∠v11v10v12=2∘\angle{v_{11} v_{10} v_{12}} = 2^{\circ}.

In the fourth query, minimal possible nn is 180180 (not 9090).

第一个查询的答案如上图所示。

第二个查询的答案在一个正 1818 边形中达到。例如,∠v2v1v6=50∘\angle{v_2 v_1 v_6} = 50^{\circ}。

第三个查询的示例角度为 ∠v11v10v12=2∘\angle{v_{11} v_{10} v_{12}} = 2^{\circ}。

在第四个查询中,最小可能的 nn 是 180180(而非 9090)。

输入解题思路,AI测评打分。不知道怎么写?

首页