A12084 | Math
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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 $n$ , you can perform the following operations zero or more times:
- mul $x$ : multiplies $n$ by $x$ (where $x$ is an arbitrary positive integer).
- sqrt: replaces $n$ with $\sqrt{n}$ (to apply this operation, $\sqrt{n}$ must be an integer).
You can perform these operations as many times as you like. What is the minimum value of $n$ , 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?
- mul $x$ : multiplies $n$ by $x$ (where $x$ is an arbitrary positive integer).
- sqrt: replaces $n$ with $\sqrt{n}$ (to apply this operation, $\sqrt{n}$ must be an integer).
You can perform these operations as many times as you like. What is the minimum value of $n$ , 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?
输入格式
The only line of the input contains a single integer $n$ ( $1 \le n \le 10^6$ ) — the initial number.
输出格式
Print two integers: the minimum integer $n$ that can be achieved using the described operations and the minimum number of operations required.
输入输出样例
输入 #1
20
输出 #1
10 2
输入 #2
5184
输出 #2
6 4
In the first example, you can apply the operation mul $5$ to get $100$ and then sqrt to get $10$ .
In the second example, you can first apply sqrt to get $72$ , then mul $18$ to get $1296$ and finally two more sqrt and you get $6$ .
Note, that even if the initial value of $n$ is less or equal $10^6$ , it can still become greater than $10^6$ after applying one or more operations.
In the second example, you can first apply sqrt to get $72$ , then mul $18$ to get $1296$ and finally two more sqrt and you get $6$ .
Note, that even if the initial value of $n$ is less or equal $10^6$ , it can still become greater than $10^6$ after applying one or more operations.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted