当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

7186:Jo loves counting

题目描述
Jo loves his teammate Ky's rick and roll! But he more than loves counting.

Jo thinks, for two numbers $n$ and $d$ ( $d$ is a factor of $n$ ), $d \in Good_n$ if and only if the prime factor set of $d$ $\textbf{equals}$ to that of $n$. That is, $Good_n=\lbrace d\mid n\bmod d=0\wedge \forall p\in Prime\to (d\bmod p=0\leftrightarrow n\bmod p=0)\rbrace $.

For example, $Good_{12}=\lbrace 6, 12\rbrace $ , since the factors of $12$ are $\lbrace 1, 2, 3, 4, 6, 12\rbrace $. $\lbrace 2, 3\rbrace $ are prime factors of $12$, so all its factors of their good factors must contain prime factors $2, 3$. Therefore, only $6, 12$ satisfy the condition.

For a number $n$, Jo will select a factor $d$ randomly from $Good_n$ with equal possibility. if $d=n$, then the rich Jo will pay you $n$ yuan as reward. Otherwise, you will gain nothing.

Ky, the man who treats money as dirt, wants to choose an integer from $[1, M]$ randomly for Jo's game. Help Ky calculate the expectation of money he can get.
输入解释
The first line contains an integer $T(T≤12)$ . Then $T$ test cases follow.

For each test case, there is only one integer $M(1\leq M\leq 10^{12})$.

It's guaranteed that there are at most $6$ cases such that $M>10^6$ .
输出解释
For each test case, output one integer in a single line --- the expectation of the money Ky can get.

Since it can be too large, print it modulo $4179340454199820289(=29\cdot 2^{57}+1)$.
输入样例
1
4
输出样例
2
来自杭电HDUOJ的附加信息
Hint $Good_1=\lbrace1\rbrace $$Good_2=\lbrace2\rbrace $$Good_3=\lbrace3\rbrace $$Good_4=\lbrace2, 4\rbrace $Therefore, the answer is $\displaystyle {1\over 4}({1\over |Good_1|}+{2\over |Good_2|}+{3\over |Good_3|}+{4\over |Good_4|})={1\over 4}({1\over 1}+{2\over 1}+{3\over 1}+{4\over 2})=2$

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-7186

最后修改于 2022-09-15T06:17:13+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
12000/6000MS(Java/Others) 524288/262144K(Java/Others)