Skip to main content

Practice · 4 of 5

Pairs Divisible by Seven

CHALLENGE
Difficulty: advanced+25 XP

**Bài toán.** Count pairs i < j with (a_i + a_j) divisible by 7. **Constraints:** 1 ≤ n ≤ 2·10^5; 0 ≤ a_i ≤ 10^9 (the large test gives a_i = i·i mod 1 000 000 003). Residual counting: c[r]·c[7−r] plus C(c[0], 2).

Back to lesson: Practice: Attack Pattern Drills