Data Structures & AlgorithmsHardCodeforces Div2 B-D · ICPC regional
How many index pairs i < j in [0, 1, 2, 3, 4] satisfy a[i] + a[j] = a[i] * a[j]?
- A. 0
- B. 1
- C. 2
- D. 10
Correct answer: A. 0
Rewrite a + b = ab as (a - 1)(b - 1) = 1. Only a = b = 0 or a = b = 2 satisfy it, and those need repeated values, so the count is 0.
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
- Repeatedly remove adjacent equal characters from "abbaca" using a stack. How many characters are removed in total?
- How many integers n from 1 to 99 inclusive have both n and n + 1 squarefree (not divisible by any square greater than 1)?
- Choose the fewest intervals of length 3 (covering integer points s, s+1, s+2 for a start s from 1 to 8) so that every integer point from 1…
- How many integers x with 1 ≤ x ≤ 2024 have NO two equal adjacent digits in their decimal representation?
- How many integers x with 1 ≤ x ≤ 500 have a decimal digit sum divisible by 3?
- You may swap the digits at exactly one pair of positions in the number 98368 (at most once). What is the largest number you can obtain?