PivotOJ

Vepar

시간 제한: 1500ms메모리 제한: 512MB출처: COCI 2020-2021BOJ 20661

문제

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.

힌트

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.

예제

예제 1

입력
2
9 10 3 6
2 5 7 9
출력
DA
NE

예제 2

입력
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
코드를 제출하려면 로그인하세요.