Skip to main content

Practice · 1 of 3

The 10^18 Count

CHALLENGE
Difficulty: advanced+25 XP

**Scenario.** Count integers in [1, N], N ≤ 10^18, whose digit sum is divisible by 9. Which family is forced by the value bound? **Which approach is the best fit? The program only needs to print the letter.** **A)** Sieve every number up to N **B)** Digit DP over the ≤ 19 digits, tracking sum mod 9 **C)** Segment tree over the value axis **D)** DSU on digits

Back to lesson: Practice: Budget Drills