count_a distinct numbers, none of them divisible by skip_a.
- Group B needs count_b distinct numbers, none of them divisible by skip_b.
- No number may be given to both groups.
Return the smallest possible value of the largest number handed out.skip_a=3, skip_b=2, count_a=2, count_b=2 → 4
Group A gets 2 and 4 (not multiples of 3) and group B gets 1 and 3 (odd). The largest number is 4.
skip_a=2, skip_b=2, count_a=3, count_b=1 → 7
Both groups can only use odd numbers, and four distinct ones are needed: 1, 3, 5 and 7. So 7 cannot be avoided.
skip_a=3, skip_b=2, count_a=2, count_b=2
4
Run checks the first 3 tests in your browser. Submit checks all 103 tests on the server, hidden ones included.