Problem Author: | Hasan Saleh (MathModel) |
Prepared by: | Hasan Saleh (MathModel) |
Edited by: | Hasan Saleh (MathModel) |
Solution
By caseworking the rotations we can observe that is achievable when |x|=|a\cdot d-b \cdot c| only , thus checking the condition is enough and sufficient.
Complexity .
def solve():
x=int(input())
a,b=map(int,input().split())
c,d=map(int,input().split())
v=a*d-b*c
if(-v==x or v==x):
print("YES")
else:
print("NO")
for _ in range(int(input())):
solve()