#P10991. [2015杭电多校]Arithmetic Sequence
[2015杭电多校]Arithmetic Sequence
Arithmetic Sequence
Problem Description
A sequence are called -arithmetic sequence if and only if there exist such that for every and for every . Teacher Mai has a sequence . He wants to know how many intervals there are that are -arithmetic sequence.
Input
There are multiple test cases. For each test case, the first line contains three numbers , the next line contains integers .
Output
For each test case, print the answer.
Sample Input
5 2 -2
0 2 0 -2 0
5 2 3
2 3 3 3 3
Sample Output
12
5
Author
xudyh
Source
2015 Multi-University Training Contest 9