Happy Birthday CodeChef

All submissions for this problem are available.
Chef invited $N$ people for celebrating his $10^{th}$ birthday. He decides to serve cakes for the guests, so he gives the order of $M$ cakes to **‘Chefland Bakers’**. The newly hired baker was given the job. He prepared cakes which are **cubical**, but the side length of cake $i$ is $A_i$. All the guests at the party are dear to Chef, so he decides to give all of them slices of equal volume. Each guest receives only one slice. All the remaining parts of the cakes are returned to the bakery. Can you help Chef find maximum integer volume slice that can be cut so that all the guests receive a slice of equal volume? The shape of the slice is not important. A single slice is a block of cake that belongs to one cake only from which it is cut. ###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 two spaceseparated integers denoting $N$ and $M$.  The second line contains $M$ spaceseparated integers denoting $A_1, A_2, …, A_M$. ###Output: For each test case, print a single line containing a single integer  the maximum integer volume of a slice. ###Constraints  $1 \leq T \leq 10^3$  $1 \leq N, M \leq 10^3$  $1 \leq A_i \leq 5*10^2$ ###Sample Input: 1 3 5 1 1 1 2 2 ###Sample Output: 4 ###Explanation: Two slices of volume 4 each can be taken from cake 5 and one slice of volume 4 can be taken from cake 4.Author:  kishen1912000 
Tags  kishen1912000 
Date Added:  15032019 
Time Limit:   0.5 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, 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