Data Structures & AlgorithmsHardCodeforces Div2 B-D · ICPC regional

How many index pairs i < j in [2, 5, 4, 10, 3, 15] have a product that is a multiple of 10?

  1. A. 9
  2. B. 12
  3. C. 15
  4. D. 5

Correct answer: A. 9

A product is a multiple of 10 when it has a factor 2 and a factor 5: every pair with 10 (5 pairs) plus 2·5, 2·15, 4·5, 4·15 = 9. Checking only the factor 5 (or only 2) gives 12, 15 counts all pairs and 5 only those that use 10.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic