Chef Chick

All submissions for this problem are available.
### Read problems statements in [Hindi](http://www.codechef.com/download/translated/COOK114/hindi/CHFCHK.pdf), [Mandarin Chinese](http://www.codechef.com/download/translated/COOK114/mandarin/CHFCHK.pdf), [Russian](http://www.codechef.com/download/translated/COOK114/russian/CHFCHK.pdf), [Vietnamese](http://www.codechef.com/download/translated/COOK114/vietnamese/CHFCHK.pdf), and [Bengali](http://www.codechef.com/download/translated/COOK114/bengali/CHFCHK.pdf) as well. Chef Chick loves to jump a lot. Once, it realised that it was on an infinitely long road, and decided to travel along this road by jumping. Let's view the road as the $x$axis in a 1D coordinate system. Initially, Chef Chick is at the coordinate $x=0$, and it wants to move only in the positive $x$direction. Moreover, Chef Chick has $N$ favourite integers $a_1, a_2, \ldots, a_N$, and it wants to jump on the coordinates that are multiples of these favourite numbers — when its current position is $x$, it jumps to the smallest coordinate $y \gt x$ such that $y$ is an integer multiple of at least one of the values $a_1, a_2, \ldots, a_N$; the length of such a jump is $yx$. This way, Chef Chick keeps jumping along the road forever in the positive $x$direction. You need to find the length of the longest jump it will make, i.e. the largest integer $d$ such that Chef Chick makes at least one jump with length $d$ and never makes any jump with a greater length. It can be proved that such an integer always exists. ### Input  The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.  The first line of each test case contains a single integer $N$.  The second line contains $N$ spaceseparated integers $a_1, a_2, \ldots, a_N$. ### Output For each test case, print a single line containing one integer — the length of the longest jump that Chick will make. ### Constraints  $1 \le T \le 100$  $1 \le N \le 100$  $1 \le a_i \le 10^5$ for each valid $i$  $a_1, a_2, \ldots, a_N$ are pairwise distinct ### Example Input ``` 1 2 2 3 ``` ### Example Output ``` 2 ``` ### Explanation **Example case 1:** The sequence of coordinates on which Chef Chick would jump starts with $(0, 2, 3, 4, 6, \ldots)$. A longest jump is e.g. from $4$ to $6$, with length $2$.Author:  adarshag 
Editorial  https://discuss.codechef.com/problems/CHFCHK 
Tags  adarshag, cook114 
Date Added:  2012020 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, SQL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, R, COB, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions