Skip to main content

Practice · 1 of 3

Divisible Digit Sums

CHALLENGE
Difficulty: advanced+25 XP

**Problem.** Line 1: q. Each line: N. Print one integer per line: the count of x in [1, N] with digit sum divisible by 3. **Constraints:** 1 ≤ q ≤ 1000; 1 ≤ N ≤ 10^18. Free-table digit DP: one 3-state transition table covers every query.

Back to lesson: Practice: Digit Trio