1062B.md (1607B)
1 Source: https://codeforces.com/problemset/problem/1062/B 2 3 B. Math 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 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: 22 23 * mul $x$: multiplies $n$ by $x$ (where $x$ is an arbitrary positive integer). 24 * sqrt: replaces $n$ with $\sqrt{n}$ (to apply this operation, $\sqrt{n}$ must be an integer). 25 26 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? 27 28 Apparently, no one in the class knows the answer to this problem, maybe you can help them? 29 30 Input 31 32 The only line of the input contains a single integer $n$ ($1 \le n \le 10^6$) — the initial number. 33 34 Output 35 36 Print two integers: the minimum integer $n$ that can be achieved using the described operations and the minimum number of operations required. 37 38 Examples 39 40 Input 41 42 ``` 43 20 44 ``` 45 46 Output 47 48 ``` 49 10 2 50 ``` 51 52 Input 53 54 ``` 55 5184 56 ``` 57 58 Output 59 60 ``` 61 6 4 62 ``` 63 64 Note 65 66 In the first example, you can apply the operation mul $5$ to get $100$ and then sqrt to get $10$. 67 68 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$. 69 70 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.