CF2205B.Simons and Cakes for Success
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
When I succeed, we'll share the cakes together!
— SHUN
Simons has n friends and a huge amount of cakes. To divide the cakes fairly, you are asked to help him solve the following problem:
- Find the minimum positive integer k such that n is a divisor of kn.
It can be proved that the answer always exists under the given constraints.
当我成功时,我们将一起分享蛋糕!
——SHUN
西蒙有 n 个朋友和大量蛋糕。为了公平地分配蛋糕,你需要帮他解决以下问题:
- 求最小的正整数 k,使得 n 整除 kn。
在给定约束条件下,可以证明答案一定存在。
输入格式
Each test contains multiple test cases. The first line contains the number of test cases t (1≤t≤100). The description of the test cases follows.
The only line of each test case contains a single integer n (2≤n≤109) — the number of friends Simons has.
每个测试包含多个测试用例。第一行包含测试用例的数量 t(1≤t≤100)。随后是各测试用例的描述。
每个测试用例仅有一行,包含一个整数 n(2≤n≤109)——即西蒙拥有的朋友数量。
输出格式
For each test case, output a single integer — the minimum k you found.
对于每个测试用例,输出一个整数——即你找到的最小 k。
输入输出样例
输入#1
4 8 12 369 55635800
输出#1
2 6 123 2090
说明/提示
In the first test case:
- 18=1, and 8 is not a divisor of 1;
- 28=256, and 8 is a divisor of 256, because 256=8⋅32.
Thus, the minimum possible k is 2.
In the second test case, 12 is a divisor of 612=2176782336, because 2176782336=12⋅181398528.
在第一个测试用例中:
- 18=1,而 8 不是 1 的约数;
- 28=256,而 8 是 256 的约数,因为 256=8⋅32。
因此,最小可能的 k 为 2。
在第二个测试用例中,12 是 612=2176782336 的约数,因为 2176782336=12⋅181398528。
输入解题思路,AI测评打分。不知道怎么写?