시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1.5 초 | 512 MB | 61 | 33 | 27 | 54.000% |
Two intervals of positive integers {a, a + 1, . . . , b} and {c, c + 1, . . . , d} are given. Determine whether the product c·(c+1)· · · d is divisible by the product a·(a+1)· · · b.
The first line contains a single integer t (1 ≤ t ≤ 10), the number of independent test cases.
Each of the following t lines contains four positive integers ai, bi, ci, di (1 ≤ ai ≤ bi ≤ 107, 1 ≤ ci ≤ di ≤ 107).
Output t lines in total. For the i-th test case, output DA
(Croatian for yes) if ai · (ai + 1) · · · bi divides ci · (ci + 1)· · · di, and output NE
(Croatian for no) otherwise.
2 9 10 3 6 2 5 7 9
DA NE
6 1 2 3 4 1 4 2 3 2 3 1 4 1 3 2 4 19 22 55 57 55 57 19 22
DA NE DA DA DA DA
We have 9 · 10 = 90 and 3 · 4 · 5 · 6 = 360. The answer is DA
because 90 divides 360.
We calculate 2 · 3 · 4 · 5 = 120, which doesn’t divide 7 · 8 · 9 = 504. Thus the second answer is NE
.