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

(1≤d≤n)

.

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 p1,p2,⋯,pm

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 2≤n≤1024

.

The second lines contains m

distinct prime numbers p1,p2,⋯,pm

, satisfying 2≤pi≤106

.

About 2⋅105

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 1
2
4 1
2
6 2
2 3
8 1
2
10 2
2 5
12 2
2 3
 
Sample Output
Case #1: 2.0000000000
Case #2: 2.5000000000
Case #3: 2.6666666667
Case #4: 2.8333333333
Case #5: 2.6666666667
Case #6: 3.0333333333

HDU 多校1.5的更多相关文章

  1. 2018 HDU多校第四场赛后补题

    2018 HDU多校第四场赛后补题 自己学校出的毒瘤场..吃枣药丸 hdu中的题号是6332 - 6343. K. Expression in Memories 题意: 判断一个简化版的算术表达式是否 ...

  2. 2018 HDU多校第三场赛后补题

    2018 HDU多校第三场赛后补题 从易到难来写吧,其中题意有些直接摘了Claris的,数据范围是就不标了. 如果需要可以去hdu题库里找.题号是6319 - 6331. L. Visual Cube ...

  3. 2015 HDU 多校联赛 5363 Key Set

    2015 HDU 多校联赛 5363 Key Set 题目: http://acm.hdu.edu.cn/showproblem.php? pid=5363 依据前面给出的样例,得出求解公式 fn = ...

  4. 2015 HDU 多校联赛 5317 RGCDQ 筛法求解

    2015 HDU 多校联赛 5317 RGCDQ 筛法求解 题目  http://acm.hdu.edu.cn/showproblem.php? pid=5317 本题的数据量非常大,測试样例多.数据 ...

  5. [HDU多校]Ridiculous Netizens

    [HDU多校]Ridiculous Netizens 点分治 分成两个部分:对某一点P,连通块经过P或不经过P. 经过P采用树形依赖背包 不经过P的部分递归计算 树型依赖背包 v点必须由其父亲u点转移 ...

  6. 【杂题总汇】HDU多校赛第十场 Videos

    [HDU2018多校赛第十场]Videos 最后一场比赛也结束了…… +HDU传送门+ ◇ 题目 <简要翻译> 有n个人以及m部电影,每个人都有一个快乐值.每场电影都有它的开始.结束时间和 ...

  7. hdu多校1002 Balanced Sequence

    Balanced Sequence Time Limit: / MS (Java/Others) Memory Limit: / K (Java/Others) Total Submission(s) ...

  8. HDU多校(Distinct Values)

    Problem Description Chiaki has an array of n positive integers. You are told some facts about the ar ...

  9. hdu多校6

    这个场要恶心死我了.. 1001 积分题,不要四舍五入 //#pragma comment(linker, "/stack:200000000") //#pragma GCC op ...

  10. hdu 多校第一场

    1001 思路:打表可以发现只有3|n 和 4|n 的情况有解,判一下就好啦. #include<bits/stdc++.h> #define LL long long #define f ...

随机推荐

  1. Android中有哪些好的开发框架?

    在安卓开发中,框架的使用必不可少,合理利用一些好的开发框架,往往可以达到事半功倍的效果.本文小编就将和大家分享安卓开发者不得不知的5款框架,一起来看看吧,新技能get走起~~ 1.thinkAndro ...

  2. DataBase -- FUNCTION

    SQL拥有很多课用于计数和计算的内建函数. SELECT function(列) FROM 表 合计函数(Aggregate Functions) Aggregate函数的操作面向一系列的值,并返回一 ...

  3. 【题解】APIO2013机器人

    其实这题前前后后的思考时间加起来应该有两天之久了,dp状态,转移方式等等都还是比较好想,然而左看右看觉得spfa复杂度未免太爆炸……然后选择看了一篇题解,发现在多重优化之下,其实是可以过的…… 首先建 ...

  4. Jlink下载u-boot

    由于各种原因我的fl2440无启动代码,无任何程序,这时要通过jlink来烧录相关boot程序. 准备工作: 1.Jlink使用jlink commander工具 2.初始化sdram的程序boot. ...

  5. BZOJ 2707: [SDOI2012]走迷宫 拓扑+高斯消元+期望概率dp+Tarjan

    先Tarjan缩点 强连通分量里用高斯消元外面直接转移 注意删掉终点出边和拓扑 #include<cstdio> #include<cstring> #include<a ...

  6. API网关Kong部署和使用文档

    KONG安装使用说明 系统版本:ubuntu14 1.下载安装包 $ wget https://github.com/Mashape/kong/releases/download/0.8.3/kong ...

  7. [poj 2274]后缀数组+最长公共子串

    题目链接:http://poj.org/problem?id=2774 后缀数组真的太强大了,原本dp是O(nm)的复杂度,在这里只需要O(n+m). 做法:将两个串中间夹一个未出现过的字符接起来,然 ...

  8. c#中数据库字符串的连接几种方式

    ADO.net 中数据库连接方式(微软提供) 微软提供了以下四种数据库连接方式:System.Data.OleDb.OleDbConnectionSystem.Data.SqlClient.SqlCo ...

  9. HTML页面为什么设置了UTF-8仍然中文乱码

    如题,其实问题很简单,在用EditPlus写html页面的时候,发现设置为UTF-8的时候仍然出现了乱码,这是一个很奇怪的问题,而且我完全考虑了浏览器的解析问题,将title放在了了meta标签之后, ...

  10. 转载--博弈问题及SG函数(真的很经典)

    博弈问题若你想仔细学习博弈论,我强烈推荐加利福尼亚大学的Thomas S. Ferguson教授精心撰写并免费提供的这份教材,它使我受益太多.(如果你的英文水平不足以阅读它,我只能说,恐怕你还没到需要 ...