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?
- A. 9
- B. 12
- C. 15
- 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.
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
- With weight limit 15, what is the maximum number of items from [5, 3, 8, 2, 7, 4] you can carry (choose any subset)?
- How many integers from 1 to 500 inclusive are divisible by 4 but not by 6?
- How many different output orders can a stack produce from the input 1, 2, 3, 4 pushed in order?
- In "abccbaxyz", take the longest palindromic substring (the first one if tied) and count its distinct characters.
- In "abcdbefg", what is the 0-based index of the first character that repeats an earlier character?
- How many integers from 1 to 60 inclusive are multiples of 3 or of 4 but not of 12?