P14040 [HackerEarth] Little Anay is afraid of darkness. He has N candles where height of each candle is known. First day he needs to light 1 candle, Second day he needs to light 2, and so on, till it is poss
普及-
题目描述

Little Anay is afraid of darkness. He has N candles where height of each candle is known. First day he needs to light 1 candle, Second day he needs to light 2, and so on, till it is possible.
If a candle is lit, its height gets reduced by 1 each day. He can also extinguish the candle but only at the end of the day. He wants to know the maximum days he can spend with N candles . But, unable to do so, He seeks for your help. You being the elder cousin of Anay, write a program for him to find the maximum days that he can cover using N candles.

INPUT

First line contain T no of test cases

Second line of input contains an integer M. then, next line contains M integers as height of Candles N, separated by spaces.

OUTPUT

Print the maximum number of days he can be away from darkness.

Constraints:

0 ≤ N ≤ 25000

1 ≤ t ≤ 1000000

SAMPLE INPUT
1
3
2 2 2

SAMPLE OUTPUT
3

Explanation

First Line is the no of test cases
2nd line is the no of candles
Next line gives heights of candles

There are 3 candles of height 2,2,2
End of 1st day 1,2,2
End of 2nd day 1,1,1
End of 3rd day 0,0,0

输入格式

见题面

输出格式

见题面

样例输入
1 3 2 2 2
样例输出
5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29 5 13 22 29