/* this is the code, the following questions, ask bosses analysis analysis where there is error, thank you */
# include # include # include Struct sb { Int num1 [3]. Int num2 [3]. } hx [5]. Int main () { Int the cas (int a [], int [] b); Int n, I, k, * u * o; Int the SBS; The scanf (" % d ", & amp; n); for(i=0; I & lt; n; I++) { For (k=0; K & lt; 3; K++) { The scanf (" % d % d ", & amp; Hx [k]. Num1, & amp; Hx [k]. Num2); } U=& amp; Hx [0]. Num1; O=& amp; Hx [0]. Num2; The SBS=cas (u, o); Printf (" % d ", SBS); } return 0; } Int the cas (int a [], int [] b) { Int I, k, p, * j * h. J=a; H=b; for(i=0; ; I++) { For (k=0; ; K++) { For (p=0; ; P++) { If (I % * j==* h& & K % (* j + 1)==(* h + 1) & amp; & P==% j + 2 (*) (* h + 2)) { If (I==* j& & *==j * h) { Return * j; } } } } } }
Huaian folklore with a story, "han xin point soldier", the second a idiom "han xin point soldier, the more the better," han xin with 1500 soldiers in battle, killed five centuries, stood a row of three people, more than 2 people; Stood a row of 5 people, more than four people; Station 7, 6 people, the more the han xin right number: 1049, if I give you some conditions, could you help me to meet the conditions of the smallest positive integer? , of course, the problem is simple, give you each group of data line has three Numbers, Numbers in each row of the first number is the divisor d, the second number is the remainder m, then please work out a minimal positive integer n (n & lt; 1000000), the n can satisfy the three lines of figures at the same time n/d==x... M.
Input
The first line is the number of sets of data nCase (n<=5), the following three ncase lines, each three lines is a set of data that is to give you three sets of data,
The Output
For each group of input, output a line, is obtained by the least positive integer,