CF1062B.Math

普及/提高-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

JATC's math teacher always gives the class some interesting math problems so that they don't get bored. Today the problem is as follows. Given an integer nn, you can perform the following operations zero or more times:

  • mul xx: multiplies nn by xx (where xx is an arbitrary positive integer).
  • sqrt: replaces nn with n\sqrt{n} (to apply this operation, n\sqrt{n} must be an integer).

You can perform these operations as many times as you like. What is the minimum value of nn, that can be achieved and what is the minimum number of operations, to achieve that minimum value?

Apparently, no one in the class knows the answer to this problem, maybe you can help them?

JATC 的数学老师总是给全班同学出一些有趣的数学题,以免他们感到无聊。今天的问题如下:给定一个整数 nn,你可以执行以下操作零次或多次:

  • mul xx:将 nn 乘以 xx(其中 xx 是任意正整数);
  • sqrt:将 nn 替换为 n\sqrt{n}(要执行此操作,n\sqrt{n} 必须为整数)。

你可以任意多次执行这些操作。问:所能达到的 nn 的最小值是多少?以及达到该最小值所需的最少操作次数是多少?

显然,班上没人知道这道题的答案,也许你能帮帮他们?

输入格式

The only line of the input contains a single integer nn (1≤n≤1061 \le n \le 10^6) — the initial number.

输入仅有一行,包含一个整数 nn(1≤n≤1061 \le n \le 10^6)——初始数字。

输出格式

Print two integers: the minimum integer nn that can be achieved using the described operations and the minimum number of operations required.

输出两个整数:通过所述操作所能达到的最小整数 nn,以及所需的最少操作次数。

输入输出样例

  • 输入#1

    20

    输出#1

    10 2
  • 输入#2

    5184

    输出#2

    6 4

说明/提示

In the first example, you can apply the operation mul 55 to get 100100 and then sqrt to get 1010.

In the second example, you can first apply sqrt to get 7272, then mul 1818 to get 12961296 and finally two more sqrt and you get 66.

Note, that even if the initial value of nn is less or equal 10610^6, it can still become greater than 10610^6 after applying one or more operations.

在第一个例子中,你可以先执行乘法操作 mul 5 得到 100100,然后执行开方操作 sqrt 得到 1010。

在第二个例子中,你可以先执行开方操作 sqrt 得到 7272,再执行乘法操作 mul 18 得到 12961296,最后再执行两次开方操作,即可得到 66。

注意:即使初始值 nn 不超过 10610^6,在执行一次或多次操作后,其值仍可能超过 10610^6。

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

首页