ABC200C Ringo's Favorite Numbers 2
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
Score : 300 points
Problem Statement
Ringo loves the integer 200. Solve the problem below for him.
Given a sequence A of N positive integers, find the pair of integers (i,j) satisfying all of the following conditions:
- 1≤i<j≤N;
- Ai−Aj is a multiple of 200.
Constraints
- All values in input are integers.
- 2≤N≤2×105
- 1≤Ai≤109
Input
Input is given from Standard Input in the following format:
N A1 A2 … AN
Output
Print the answer as an integer.
Sample Input 1
6 123 223 123 523 200 2000
Sample Output 1
4
For example, for (i,j)=(1,3), A1−A3=0 is a multiple of 200.
We have four pairs satisfying the conditions: (i,j)=(1,3),(1,4),(3,4),(5,6).
Sample Input 2
5 1 2 3 4 5
Sample Output 2
0
There may be no pair satisfying the conditions.
Sample Input 3
8 199 100 200 400 300 500 600 200
Sample Output 3
9
摸底测试
- Status
- Done
- Rule
- IOI
- Problem
- 8
- Start at
- 2023-8-3 8:30
- End at
- 2023-8-3 11:30
- Duration
- 3 hour(s)
- Host
- Partic.
- 15