#P10740. [SEERC 2020] Divisible by 3
[SEERC 2020] Divisible by 3
Problem Description
Define the weight of a sequence as .
Now you are given an array of length . Find how many pairs there are such that and the weight of is divisible by .
Input Format
The first line contains an integer .
Then follow integers .
Output Format
Output the total number of valid pairs.
3
5 23 2021
4
5
0 0 1 3 3
15
10
0 1 2 3 4 5 6 7 8 9
20
Hint
For the first sample, there are valid choices: , , , and .
Translated by ChatGPT 5