DCP-393: Maximum Average Back to All Problems

Easy Beginners Problems > Ad-hoc


You will be given an array of **N** integers. You have to select a contiguous sub-array whose **Average** is maximum and print that maximum average. Average = (sum of the elements / number of elements) **Note : It is guaranteed that the answer will always be an integer.** Input: ------ Input starts with an integer **T (1≤ T≤ 10)**, denoting the number of test cases. Each case contain an integer **N ( 1≤ N ≤100000)**. The next line contains **N** space separated **signed 32-bit integers** denoting the elements of the array. Output: ------- For each test case print the **maximum average value** of the sub-array. Sample Input ------------ 2 2 7 -5 3 1 1 1 Sample Output ------------- 7 1


Problem Setter:

S.M. SHAHEEN SHA

Please login to submit solution to this problem.

Problem Limits

Language Time Limit (seconds)
C 1.00
C++ 1.00
C++14 1.00
C# 2.00
Go 2.00
Java 2.00
JavaScript 2.00
Objective-C 2.00
Perl 2.00
PHP 2.00
Python 2.00
Python3 2.00
Ruby 2.00
VB.Net 2.00

Problem Stats

26/76

Solve/Submission

Ranking

# User Language Timing
01 feodorv C 0.04s
02 Morass Cpp14 0.05s
03 indroneel Cpp14 0.09s
04 anik_JU Cpp 0.09s
05 MRoy Cpp 0.09s
06 rayhan50001 Cpp 0.11s
07 Fahim_41 C 0.11s
08 sazal_dev Cpp 0.12s
09 iamsadee Cpp 0.12s
10 belal_mbstu Cpp14 0.12s
11 Riad_IIT7 C 0.12s
12 dipta007 Cpp 0.12s
13 BishalG Cpp 0.12s
14 mahbubcseju Cpp 0.12s
15 Trusted_Frustrated Cpp14 0.12s
16 emrul Cpp 0.12s
17 souravahmed C 0.13s
18 SOHAN Cpp 0.31s
19 incognito_ju Cpp 0.33s
20 tariqiitju Python3 0.36s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support