Data Structures & AlgorithmsHardCodeforces Div2 B-D · ICPC regional
How many index pairs i < j in [12, 21, 30, 43, 66, 111, 3] have equal decimal digit sums?
- A. 10
- B. 15
- C. 21
- D. 5
Correct answer: A. 10
Digit sums are 3, 3, 3, 7, 12, 3, 3; the five 3s give C(5,2) = 10 equal pairs. Using the repeated digital root makes 66 (12 → 3) join the group: C(6,2) = 15. 21 counts all pairs and 5 is the group size, not its pairs.
Practise more Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questionsArrays, Strings, Linked Lists, Stacks, Queues and Hashing: notes and key points
More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions
- How many ordered index pairs (i, j) in [1, 3, 4, 7, 10, 12, 15] satisfy a[j] - a[i] = 3?
- How many integers from 1 to 10000 inclusive are multiples of 7 whose decimal digit sum is exactly 7?
- For "aabaabaa", how many indices i >= 1 have Z-function value exactly 2?
- How many ordered pairs (a, b) of integers with a >= 2 and b >= 2 satisfy a b = 36?
- Moving one unit per step, what is the minimum total number of unit moves to make every element of [1, 2, 9, 10, 12] equal to a common…
- How many index triples i < j < k in [1, 2, 3, 4, 5, 6] satisfy a[i] + a[k] = 2 a[j]?