report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
3 - MarisaOJ: Marisa Online Judge

3

Time limit: 1000 ms
Memory limit: 256 MB
Given an array $A$ of $n$ integers, count the nummber of pairs of indices $i < j$ that $A_i + A_j$ is divisible by $3$. ### Input - The first line contains an integer $n$. - The second line contains $n$ integers $A_i$. ### Output - Print a single integer, which is the number of satisfied pairs. ### Constraints - $1 \le n \le 10^5$. - $1 \le A_i \le 10^9$. ### Example Input: ``` 3 1 2 3 ``` Output: ``` 1 ```
Other problems (Level 0)
Sum of divisors
Equal pairs
GCD and LCM
3
String queries
Consecutive
Prison
Topic
Basic
Rating 800
Solution (1) Solution