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

建议使用的浏览器:

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

5239:Doom

题目描述
THE END IS COMINGGGGGG!

Mike has got stuck on a mystery machine. If he cannot solve this problem, he will go to his doom.

This machine is consist of $n$ cells, and a screen. The $i$-th cell contains a number $a_i(1 \leq i \leq n)$. The screen also contains a number $s$, which is initially $0$.

There is a button on each cell. When the $i$-th is pushed, Mike observes that, the number on the screen will be changed to $s + a_i$, where $s$ is the original number. and the number on the $i$-th cell will be changed to $a_i^2$.

Mike observes that the number is stored in radix $p$, where $p = 9223372034707292160$. In other words  , the operation is under modulo $p$.

And now, Mike has got a list of operations. One operation is to push buttons between from $l$-th to $r$-th (both included), and record the number on the screen. He is tired of this stupid work, so he asks for your help. Can you tell him, what are the numbers recorded.

输入解释
The first line contains an integer $T$($T \le 5$), denoting the number of test cases.

For each test case, the first line contains two integers $n, m$($1 \leq n, m\leq 10^5$).

The next line contains $n$ integers $a_i$($0 \leq a_i < p$), which means the initial values of the $n$ cells.

The next $m$ lines describe operations. In each line, there are two integers $l, r (1 \leq l \leq r \leq n)$, representing the operation.

输出解释
For each test case, output ''Case #t:'', to represent this is the $t$-th case. And then output the answer for each query operation, one answer in a line.

For more details you can take a look at the example.
输入样例
2
4 4
2 3 4 5
1 2
2 3
3 4
1 4
1 3
2
1 1
1 1
1 1
输出样例
Case #1:
5
18
39
405
Case #2:
2
6
22
来自杭电HDUOJ的附加信息
Recommend

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

源链接: HDU-5239

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

共提交 0

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