Submit | All submissions | Best solutions | Back to list |
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 SCM qobi |
hide comments
2011-04-19 12:07:12 HWK
@XeRon!X: Thanks! The cause of failure was strange. |
|
2011-04-19 04:59:14 XeRoN!X
@HWK, 12x+18y=30. Your code gives 'no', answer is 'yes'. |
|
2011-04-18 18:06:26 HWK
@XeRon!X: Could you say me why 4978304 gives WA. At home it works. |