首页 > 代码库 > HDU 多校1.5

HDU 多校1.5

Expectation Division

Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 0    Accepted Submission(s): 0
Special Judge


Problem Description
To be frank with you, this problem is a classic problem of tremendous magnitude which may increase the difficulty of this problem.

We define a type of operation concerning a positive integer n技术分享 (n>1)技术分享 as to replace it with an integer d技术分享, one of factors of n技术分享 (1dn)技术分享.

You are given a positive integer n技术分享 and then we will ask you to determine the expectation number of times to utilize this type of operation if we want to change n技术分享 into 1技术分享 by operating again and again, assuming each possible d技术分享 in each operation has equal possibility to select.

For the sake of calculation, n技术分享 and all its distinct prime factors p技术分享1技术分享,p技术分享2技术分享,?,p技术分享m技术分享技术分享 will be given, satisfying n技术分享 has m技术分享 distinct prime factors exactly.
 

 

Input
The input contains multiple test cases.

For each test case:

The first line contains two positive integers n技术分享 and m技术分享 which indicates m技术分享 is the number of distinct prime factors of n技术分享, satisfying 2n10技术分享24技术分享技术分享.

The second lines contains m技术分享 distinct prime numbers p技术分享1技术分享,p技术分享2技术分享,?,p技术分享m技术分享技术分享, satisfying 2p技术分享i技术分享10技术分享6技术分享技术分享.

About 210技术分享5技术分享技术分享 test cases in total.

Warm Tips for C/C++: __int128_t is available here but standard solutions of this problem do not use this compiler-dependent data type.
 

 

Output
For each test case, output "Case #x技术分享: y技术分享" in one line (without quotes), where x技术分享 indicates the case number starting from 1技术分享 and y技术分享 denotes the expectation number of times to utilize this type of operation of corresponding case. Your answer will be considered correct if its absolute or relative error won‘t exceed 10技术分享9技术分享技术分享.
 

 

Sample Input
2 124 126 22 38 1210 22 512 22 3
 

 

Sample Output
Case #1: 2.0000000000Case #2: 2.5000000000Case #3: 2.6666666667Case #4: 2.8333333333Case #5: 2.6666666667Case #6: 3.0333333333

HDU 多校1.5