amounts and bases, and a multiplier scale. A pair of indices (i, j) counts if amounts[i] is divisible by bases[j] · scale with no remainder.
Return the number of pairs that count. Pairs with different indices are different pairs even when the numbers in them are equal.amounts=[6, 8, 12], bases=[1, 2, 3], scale=2 → 7
The scaled bases are 2, 4 and 6. 6 is divisible by 2 and 6, 8 by 2 and 4, and 12 by all three. That gives 2 + 2 + 3 = 7 pairs.
amounts=[5, 9], bases=[2, 4], scale=3 → 0
The divisors to check are 6 and 12, and neither 5 nor 9 is divisible by them, so there are no pairs.
amounts=[10, 10], bases=[5], scale=1 → 2
amounts), len(bases) ≤ 50amounts[i], bases[j] ≤ 10⁴scale ≤ 50amounts=[6, 8, 12], bases=[1, 2, 3], scale=2
7
Run checks the first 3 tests in your browser. Submit checks all 109 tests on the server, hidden ones included.