CF2171H.Shiori Miyagi and Maximum Array Score
提高+/省选-
通过率:0%
时间限制:4.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
"Are you stupid, Sendai-san?"
— Shiori Miyagi
For the cost of 5000 yen, Miyagi can ask Sendai to do whatever she wants! Today, Miyagi demands that Sendai make her an array... specifically, Miyagi only wants a very particular type of array.
For arbitrary integers b≥2 and x≥1, define v(b,x) to be the maximal k satisfying bk∣x; that is, the maximal k such that x is a multiple of bk. It can be shown that this is always a well-defined, nonnegative integer.
You are given integers n and m satisfying n≤m. Find the maximum value of ∑i=2nv(i,ai) across all arrays a of length n satisfying the following conditions:
- a is strictly increasing; that is, for all 1≤i≤n−1, ai<ai+1, and
- for all 1≤i≤n, 1≤ai≤m.
“你是不是傻,千田君?”
—— 宫城汐里
只需花费 5000 日元,宫城就能要求千田做任何她想让他做的事!今天,宫城要求千田为她构造一个数组……更准确地说,宫城只想要一种非常特殊的数组。
对任意整数 b≥2 和 x≥1,定义 v(b,x) 为满足 bk∣x 的最大整数 k;即,使得 x 是 bk 的倍数的最大 k。可以证明,该值恒为定义良好且非负的整数。
给定满足 n≤m 的整数 n 和 m。在所有满足以下条件的长度为 n 的数组 a 中,求 ∑i=2nv(i,ai) 的最大可能值:
- a 是严格递增的;即,对所有 1≤i≤n−1,有 ai<ai+1;
- 对所有 1≤i≤n,有 1≤ai≤m。
输入格式
The first line contains a single integer t (1≤t≤104) — the number of test cases.
The only line of each test case contains two integers n and m (2≤n≤m≤2⋅105).
It is guaranteed that the sum of m over all test cases does not exceed 2⋅105.
第一行包含一个整数 t(1≤t≤104)—— 测试用例的数量。
每个测试用例仅有一行,包含两个整数 n 和 m(2≤n≤m≤2⋅105)。
保证所有测试用例的 m 值之和不超过 2⋅105。
输出格式
For each test case, output a single integer, the maximum value of ∑i=2nv(i,ai) across all arrays a of length n satisfying the given conditions.
对于每个测试用例,输出一个整数,即在所有满足给定条件的长度为 n 的数组 a 中,∑i=2nv(i,ai) 的最大值。
输入输出样例
输入#1
6 4 20 6 6 6 216 3 500 2 8 5 29
输出#1
7 5 19 13 3 9
说明/提示
In the first example, one possible array is a=[6,8,9,16] which yields a value of 3+2+2=7.
It can be shown that this is the maximum value of ∑i=2nv(i,ai) across all arrays a of length n satisfying the given conditions.
在第一个例子中,一个可能的数组是 a=[6,8,9,16],其对应的值为 3+2+2=7。
可以证明,对于所有满足给定条件的长度为 n 的数组 a,该值 ∑i=2nv(i,ai) 达到最大值。
输入解题思路,AI测评打分。不知道怎么写?