#abc241e. E - Putting Candies
E - Putting Candies
Score : points
问题描述
你得到一个长度为 的序列 。
有一个初始时为空的盘子。Takahashi 将会重复进行以下操作 次:
- 设 为盘子上糖果的数量。他会再往盘子上添加 个糖果。这里, 表示 除以 后的余数。
请计算在 次操作后盘子上有多少个糖果。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
You are given a sequence of length .
There is an initially empty dish. Takahashi is going to repeat the following operation times.
- Let be the number of candies on the dish. He puts more candies on the dish. Here, denotes the remainder when is divided by .
Find how many candies are on the dish after the operations.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
5 3
2 1 6 3 1
Sample Output 1
11
The number of candies on the dish transitions as follows.
- In the -st operation, we have , so more candies will be put on the dish.
- In the -nd operation, we have , so more candies will be put on the dish.
- In the -rd operation, we have , so more candies will be put on the dish.
Thus, after the operations, there will be candies on the dish. Note that you must not print the remainder divided by .
Sample Input 2
10 1000000000000
260522 914575 436426 979445 648772 690081 933447 190629 703497 47202
Sample Output 2
826617499998784056
The answer may not fit into a -bit integer type.
update @ 2024/3/10 10:23:42