#abc247e. E - Max Min
E - Max Min
Score : points
问题描述
我们有一个长度为 的数列 和整数 与 。找出满足所有以下条件的整数对 的数量。
- 数列中从第 项到第 项的最大值是 ,最小值是 。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
We have a number sequence of length and integers and . Find the number of pairs of integers satisfying all the conditions below.
- The maximum value of is , and the minimum is .
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
4 3 1
1 2 3 1
Sample Output 1
4
pairs satisfy the conditions: .
Sample Input 2
5 2 1
1 3 2 4 1
Sample Output 2
0
No pair satisfies the condition.
Sample Input 3
5 1 1
1 1 1 1 1
Sample Output 3
15
It may hold that .
Sample Input 4
10 8 1
2 7 1 8 2 8 1 8 2 8
Sample Output 4
36
update @ 2024/3/10 10:35:54