Approach hintTry it first, then revealHide
Binary search on the answer x. The count of numbers up to x divisible by a, b or c follows from inclusion-exclusion with the pairwise and triple lcm values, computed in 64-bit arithmetic.
Binary search on the answer x. The count of numbers up to x divisible by a, b or c follows from inclusion-exclusion with the pairwise and triple lcm values, computed in 64-bit arithmetic.