NYOJ 476 who is a hero (unique prime factor decomposition theorem)
Description
Ten mathematicians (numbered 0-9) flew over the Pacific Ocean by balloon. When crossing the equator, they decided to celebrate this feat. So they opened a bottle of champagne. Unfortunately
The cork made a hole in the balloon. The hydrogen leak and the balloon began to drop. It was about to fall into the sea and everyone was about to be eaten by sharks.
But there is still a glimmer of life-if one of them sacrifices himself, his friends will be able to survive for a while. But there is still a problem -- who
Jump down? So they think of a very fair way to solve this problem-first, each person writes an integer ai and then calculates
Calculate a1 × a2 × a3 × a4 × ...... × N is the number of the approximate numbers of a10 products. For example, if there are four (1, 2, 3, 6) divisor of 6, then N is 4. This sacrifice
Your hero will be determined by the number of digits in N (the number of digits in N will jump down ). Your task is to find N.
-
Enter T (T <= 10) group test data.
10 integers (1 ≤ ai ≤ 10000 ). Sample input of single-digit output N
11 2 6 1 3 1 1 1 1 1
Sample output
9
Question Analysis:
For the unique prime factor decomposition problem, any number of n can be expressed as: n = p [0] ^ a [0] * ...... * p [I] ^ a [I] * ...... * p [n] ^ a [n], where p [I] is a prime number, a [I] is an integer> 0, while sum is, sum = (a [0] + 1 )*..... * (a [I] + 1 )*...... (a [n] + 1 ).
AC code:
/*** @ Xiaoran * unique prime factor decomposition. The number of n approx. Is PI (a [I] + 1) * res = (a [0] + 1) * (a [1] + 1 )*... * (a [n] + 1), where a [I] is a prime number */# include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Define LL long longusing namespace std; int a [10000]; int main () {int t, n; cin> t; while (t --) {int res = 1, x, k, m = 0; memset (a, 0, sizeof (a); for (int I = 0; I <10; I ++) {cin> n; if (m
-