Please enter your email address or userHandle.
Given a range [m..n]. You task is to find the number of integers divisible by either a or b in the given range.
The first line of input consists of an integer T denoting the number of test cases.The next line consists of four space seperated integers m, n, a, b where m and n denotes the range.
Print the number of integers divisible by a or b in the given range.
1 <= T <= 100
1 <= m,n <= 100000
1 <= a,b <= 500
5 11 4 6
3 1000 5 9
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Login to access your submissions.
Please choose 'ReadOnlyMode' if you needn't to 'Edit' the problem e.g. viewing OJ's solution, TestCase Files (TCFs), TimeLimit etc.