All submissions for this problem are available.
IIIT Allahabad is celebrating its annual Techno-Cultural Fiesta from 1st to 5th October. The Chef has agreed to provide the supply candies for this fest.
The Chef has N boxes of candies arranged linearly having some random number of candies in each box . Chef wants to have same number of candies in each box but he can only transfer candies to the next (i+1) th box only. He can remove any number of candies from the last box and throw them out. He wants to put maximum number candies in each box. Since you are really good at mathematics, so he has asked you to find the maximum number of candies K that he can put in each box.
First line of input contains a single integer T, number of test cases. Description of each test contains 2 lines. First line contains single integer N, number of boxes. Next line contains N integers. i th number denoting C[i], the number of candies in each box .
For each test case output the maximum number of candies each box will contain after transferring candies, K.
Constraints: 1<=T<=100 1<= N<=10^4 1<=C[i]<=10^9
Input: 3 3 3 2 1 4 1 2 3 4 3 3 1 2 Output: 2 1 2 Explanation:For first test case, he can transfer 1 candy to next box that makes configuration as 2 3 1. Then he can transfer 1 candy from 2nd box to 3rd , thus K=2.
|Time Limit:||0.247839 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, HASK, SCALA, 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, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions