#P5856. 「SWTR-3」Game
「SWTR-3」Game
Description
Little E has positive integers . He can perform the following operation any number of times:
Choose a number and a set such that are divisible by , and divide by .
- must be in the form , where is a prime number and is a positive integer.
Find the minimum number of operations needed to make all these numbers equal.
Input Format
The first line contains an integer .
The second line contains integers .
Output Format
Output one integer representing the answer.
5
12 30 48 36 18
4
10
72 81 27 90 45 45 27 99 45 18
6
4
1 2 4 8
2
Hint
"Sample 1 Explanation"
The initial sequence is 12 30 48 36 18.
Choose , after the operation it becomes 12 30 48 12 6.
Choose , after the operation it becomes 6 30 24 6 6.
Choose , after the operation it becomes 6 6 24 6 6.
Choose , after the operation it becomes 6 6 6 6 6.
A total of 4 operations are used, and the method is not unique.
"Constraints and Notes"
This problem uses bundled testdata.
| Subtask ID | Special Property | Score | ||
|---|---|---|---|---|
| There is a number equal to among | ||||
| None | ||||
For of the data, and .
For all test points, the time limit is 1s and the memory limit is 128MB.
"Source"
Sweet Round 03 B。
idea & solution: ET2006 & Alex_Wei。
Translated by ChatGPT 5
京公网安备 11011102002149号