EQCHECK - Equation Check

Given an equation of a straight line of form Ax+By=C. A,B,C are integers. You have to check if it passes through any lattice point or not.

Input

First line => T = No of test cases < 100

Next T lines contains the equation of form Ax+By=C. 1 < A,B,C < 10^6

Output

Print 'yes' if line passes through any lattice point, else print 'no' for each test case.

Example

Input:
2
2x+3y=4
6x+8y=25

Output: yes
no

Score : Source Code Length

Added by:XeRoN!X
Date:2011-03-30
Time limit:1s
Source limit:256B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64

hide comments
2014-02-13 19:27:28 Samil Vargas
:) i learn a lot with this problem
2014-02-13 19:27:28 (Tjandra Satria Gunawan)(曾毅昆)
My poor AWK code still shorter than my best C code :-O
2014-02-13 19:27:28 pika_pika
_/\_ to numerix, whereas i got 247 in pyth3.2.3 easy but my solution wasn't small enough :(
2014-02-13 19:27:28 Mukesh Tiwari
my soln id 7166467
i think mine is correct....i am getting wa again and again :P
2014-02-13 19:27:28 Paras Sharma
could you please check my submission 6448423.
it should be accepted *-)

Re(XeRon!X) : 63x+23y=7

Last edit: 2012-02-06 17:09:28
2014-02-13 19:27:28 numerix
Ever heard of "google"?
2014-02-13 19:27:28 ravi shankar prasad
What is lattice point?

RE(Debanjan):Here the Latice point is used in the same sense as http://mathworld.wolfram.com/LatticePoint.html

Last edit: 2011-04-10 19:39:34
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.