Saint Luluba
Time Limit: 0.5 sec
The Problem
(2000 B.C.) Peoples are in the darkest stage of inhumanity. Whole world is covered with dark influences. Science, Physics and Mathematics are not even in people's dream. They just have learned to count and calculate. Suddenly a miracle baby got born in China, named "Luluba". We call him "Saint Luluba" for his Excellency in predictions. His practices, passions and loves with numbers made him mystery. "OutsBook" team recently has dug his antic relics and got some wasted half left documents on the 20th march instant. We translated those scripts. There were some magic equations.
i. A+B = C
ii. AB = CD
iii. AX+BY = G Here, G = GCD (A, B)
We solved first two of them, where we can predict any of its variable if at least two of these variables are known. But the last one mystery is yet unsolved. This is why we need your help. Given A, B find out the value of X, Y, G.
The Input
There will several test cases. For each case, there will be two integers A (0<A<10^12) and B (0<B<10^12) as input. Input is terminated by EOF.
The Output
For each A, B you have to print “Case C: A x X + B x Y = G” on a separate line. Here C is the case number starting form 1, G = GCD (A, B). See the sample input output for output format.
Sample Input
15 25
25 15
7 11
11 7
Sample Output
Case 1: 15 x 2 + 25 x -1 = 5
Case 2: 25 x -1 + 15 x 2 = 5
Case 3: 7 x -3 + 11 x 2 = 1
Case 4: 11 x 2 + 7 x -3 = 1
Online Practice Contest 4 [School & College Level]
Problem Setter: Saiful Islam Niloy