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

建议使用的浏览器:

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

3670:A Sequence of Numbers

题目描述
You are given a sequence of N integers (each within the range [0, 2^16 - 1] ) along with P operations and in order to solve this problem you need to process the operations instructed as follows.

There are two kinds of operations that you will be instructed to perform:

1) Modification
- Given a non-negative number T , you need to increase the value of every number in the sequence by T . If the value of any number in the sequence is larger than 2^16 - 1 after the operation, you should divide its value by 216 and take the remainder as its value;
2) Query
- Given a non-negative number T , query how many numbers in the sequence satisfies the condition that its bitwise and result with 2^T is greater than zero.

For simplicity, all you need to do here is to output the sum ( sum < 10, 000, 000, 000 ) of the answers to all queries.
输入解释
There are multiple test cases in the input file. Each test case starts with one integer N (N<=10^5) , the number of integers in the sequence. The following N line consists of one integer P (0<=P<=2^16 - 1) , the value on i -th line being the value of the i -th number in the sequence.

Each of the following lines is either of the format ``C delta " (0<=delta) , meaning that you should increase the value of every number by delta, or ``Q i " (0<=i<=15) , meaning that you should calculate the answer to the query (as explained in the problem description). Every test case ends with one character `E' on a single line, followed by a blank line.

N = - 1 indicates the end of input file and should not be processed by your program. It is guaranteed that the total number of operations in each test case does not exceed 200,000.
输出解释
For each test case, print the sum of answers to queries on one separate line in the format as indicated in the sample output.
输入样例
3 
1 
2 
4 
Q 1 
Q 2 
C 1 
Q 1 
Q 2
E

-1
输出样例
Case 1: 5
来自杭电HDUOJ的附加信息
Recommend lcy

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

源链接: HDU-3670

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

共提交 0

通过率 --%
时间上限 内存上限
50000/20000MS(Java/Others) 32768/32768K(Java/Others)