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

建议使用的浏览器:

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

5634:Rikka with Phi

题目描述
Rikka and Yuta are interested in Phi function (which is known as Euler's totient function).

Yuta gives Rikka an array $A[1..n]$ of positive integers, then Yuta makes $m$ queries.

There are three types of queries:

$ 1 \; l \; r $

Change $A[i]$ into $\varphi(A[i])$, for all $i \in [l, r]$.

$ 2 \; l \; r \; x$

Change $A[i]$ into $x$, for all $i \in [l, r]$.

$ 3 \; l \; r $

Sum up $A[i]$, for all $i \in [l, r]$.

Help Rikka by computing the results of queries of type 3.

输入解释
The first line contains a number $T(T \leq 100)$ ——The number of the testcases. And there are no more than 2 testcases with $n > 10 ^ 5$

For each testcase, the first line contains two numbers $n,m(n \leq 3 \times 10^5, m \leq 3 \times 10^5)$。

The second line contains $n$ numbers $A[i]$

Each of the next $m$ lines contains the description of the query.

It is guaranteed that $1 \leq A[i] \leq 10^7$ At any moment.
输出解释
For each query of type 3, print one number which represents the answer.
输入样例
1
10 10
56 90 33 70 91 69 41 22 77 45
1 3 9
1 1 10
3 3 8
2 5 6 74
1 1 8
3 1 9
1 2 10
1 4 9
2 8 8 69
3 3 9
输出样例
80
122
86
来自杭电HDUOJ的附加信息
Recommend hujie

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

源链接: HDU-5634

最后修改于 2020-10-25T23:24:22+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
16000/8000MS(Java/Others) 131072/131072K(Java/Others)