Submit | All submissions | Best solutions | Back to list |
CEQU - Crucial Equation |
Let us see the following equation,
ax + by = c
Given three positive integers a, b and c. You have to determine whether there exists at least one solution for some integers value of x and y where x, y may be negative or non-negative integers.
For example if a = 2, b = 4 and c = 8 then the equation will be 2x + 4y = 8, and hence, for x = 2 and y = 1, there exists a solution.
Let us see another example for a = 3, b = 6 and c = 7, so the equation will become 3x + 6y = 7 and there exists no solution satisfying this equation.
Input
Input starts with an integer T (1 ≤ T ≤ 105) denoting the number of test cases. Each test case contains three integers a, b, and c. (1 ≤ a, b, c ≤ 106).
Output
For each test case of input print the case number and “Yes” if there exists at least one solution, print “No” otherwise.
Example
Sample Input |
Sample Output |
2 |
Case 1: Yes |
Problem Setter: Md Abdul Alim, Dept. of Computer Science, Bangladesh University of Business & Technology
Added by: | Alim |
Date: | 2014-10-15 |
Time limit: | 3s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 GOSU |
Resource: | Own Problem |
hide comments
|
|||||||||||
2016-01-17 20:17:34 crazy_coder97
output format costed me 3 wa :( Last edit: 2016-01-17 20:21:49 |
|||||||||||
2015-12-23 11:37:27
Output format costed me 1 wrng ans!!!...be careful |
|||||||||||
2015-10-20 15:15:31 kamran siddique
sifting colon right left right left.............Taking hell lot of time ....... @shantanu, Agreed. |
|||||||||||
2015-10-11 20:45:42 arpit
leave a space after colon,cost me a wa |
|||||||||||
2015-08-14 13:43:50
good problem to make it to 4 digit after 16 day streak.....;] |
|||||||||||
2015-08-10 18:34:27 shantanu tripathi
should be moved to where..... yes in tutorials.. :P |
|||||||||||
2015-08-10 18:32:03 alok singh
loved this..... one go...:P |
|||||||||||
2015-08-02 11:15:18 MishThi
Based on Bezout's Identity. |
|||||||||||
2015-07-13 09:54:50 Shashank Tiwari
https://en.wikipedia.org/wiki/B%C3%A9zout%27s_identity |
|||||||||||
2015-06-11 20:23:45 Rishabh Joshi
elementary. :) |