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 nn 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 kk such that nn is a divisor of knk^n.

It can be proved that the answer always exists under the given constraints.

当我成功时,我们将一起分享蛋糕!

——SHUN

西蒙有 nn 个朋友和大量蛋糕。为了公平地分配蛋糕,你需要帮他解决以下问题:

  • 求最小的正整数 kk,使得 nn 整除 knk^n。

在给定约束条件下,可以证明答案一定存在。

输入格式

Each test contains multiple test cases. The first line contains the number of test cases tt (1≤t≤1001 \le t \le 100). The description of the test cases follows.

The only line of each test case contains a single integer nn (2≤n≤1092\le n\le 10^9) — the number of friends Simons has.

每个测试包含多个测试用例。第一行包含测试用例的数量 tt(1≤t≤1001 \le t \le 100)。随后是各测试用例的描述。

每个测试用例仅有一行,包含一个整数 nn(2≤n≤1092\le n\le 10^9)——即西蒙拥有的朋友数量。

输出格式

For each test case, output a single integer — the minimum kk you found.

对于每个测试用例,输出一个整数——即你找到的最小 kk。

输入输出样例

  • 输入#1

    4
    8
    12
    369
    55635800

    输出#1

    2
    6
    123
    2090

说明/提示

In the first test case:

  • 18=11^8=1, and 88 is not a divisor of 11;
  • 28=2562^8=256, and 88 is a divisor of 256256, because 256=8⋅32256 = 8\cdot 32.

Thus, the minimum possible kk is 22.

In the second test case, 1212 is a divisor of 612=2 176 782 3366^{12}=2\,176\,782\,336, because 2 176 782 336=12⋅181 398 5282\,176\,782\,336=12\cdot 181\,398\,528.

在第一个测试用例中:

  • 18=11^8=1,而 88 不是 11 的约数;
  • 28=2562^8=256,而 88 是 256256 的约数,因为 256=8⋅32256 = 8\cdot 32。

因此,最小可能的 kk 为 22。

在第二个测试用例中,1212 是 612=2 176 782 3366^{12}=2\,176\,782\,336 的约数,因为 2 176 782 336=12⋅181 398 5282\,176\,782\,336=12\cdot 181\,398\,528。

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

首页