CF1036F.Relatively Prime Powers
提高+/省选-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Consider some positive integer x. Its prime factorization will be of form x=2k1⋅3k2⋅5k3⋅…
Let's call x elegant if the greatest common divisor of the sequence k1,k2,… is equal to 1. For example, numbers 5=51, 12=22⋅3, 72=23⋅32 are elegant and numbers 8=23 (GCD=3), 2500=22⋅54 (GCD=2) are not.
Count the number of elegant integers from 2 to n.
Each testcase contains several values of n, for each of them you are required to solve the problem separately.
考虑某个正整数 x,其质因数分解形式为 x=2k1⋅3k2⋅5k3⋅…。
若序列 k1,k2,… 的最大公约数(GCD)等于 1,则称 x 是优美的(elegant)。例如,数字 5=51、12=22⋅3、72=23⋅32 是优美的;而 8=23(GCD = 3)、2500=22⋅54(GCD = 2)则不是优美的。
请计算区间 [2,n] 中优美整数的个数。
每个测试用例包含多个 n 值,对每个 n 需要单独求解该问题。
输入格式
The first line contains a single integer T (1≤T≤105) — the number of values of n in the testcase.
Each of the next T lines contains a single integer ni (2≤ni≤1018).
第一行包含一个整数 T(1≤T≤105)—— 表示测试用例中 n 的取值个数。
接下来的 T 行,每行包含一个整数 ni(2≤ni≤1018)。
输出格式
Print T lines — the i-th line should contain the number of elegant numbers from 2 to ni.
输出 T 行——第 i 行应包含从 2 到 ni 的优美数的个数。
输入输出样例
输入#1
4 4 2 72 10
输出#1
2 1 61 6
说明/提示
Here is the list of non-elegant numbers up to 10:
- 4=22,GCD=2;
- 8=23,GCD=3;
- 9=32,GCD=2.
The rest have GCD=1.
以下是不超过 10 的非优雅数列表:
- 4=22,GCD=2;
- 8=23,GCD=3;
- 9=32,GCD=2。
其余数的 GCD=1。
输入解题思路,AI测评打分。不知道怎么写?