Vepar
Time limit1.5sMemory limit512 MB
For each test case, decide whether the product of all integers from c to d is divisible by the product of all integers from a to b.
- Level
Medium7 of 10
- Topics
- Number theory, Math, Combinatorics, Prefix sum
- Solved
- No attempts yet
Problem
Two intervals of positive integers and are given. Determine whether the product is divisible by the product .
Input
The first line contains a single integer , the number of independent test cases. ()
Each of the following lines contains four positive integers . (, )
Output
Output lines in total. For the -th test case, output DA if divides , and output NE otherwise.
Hint
We have and . The answer is DA because 90 divides 360.
We calculate , which does not divide . Thus the second answer is NE.