The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 398 Weeks Ago, 2 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
You are given a sequence of N integers, a[1], a[2], , , , a[N].
Find out the maximum possible average value of sub-sequences of array a.
First line of the input contains a single integer T denoting number of test cases
For each test case, first line contains a single integer denoting N, the number of elements of array a.
Next line contains N space separated integers denoting the array a.
Print T lines each line containing the maximum possible average value. Your answer will be considered correct if it's absolute or relative error is less than 10 -6.
Input: 1 5 1 3 2 1 3 Output: 3
Example case 1. Average value of subsequence 3, 3 is 3. This is the maximum possible average value.
q2
Awesomeness of a string is defined by a pair of a character C and an integer F, satisfying the following conditions :
Your aim is to maximize the value of F. If there are more than one c whose maximum F value is same than you need to chose the character c
with minimum ascii value.
For example let’s take S = abbbaaabad. subS is written in bold.
So that awesomeness of abbbaaabad is defined by c = ‘a’ and F = 3. First priority is to maximize the value of F (we prefered 3 over 1).
If there are more than one c whose maximum F value is same then we prefer the c with minimum ascii value (we prefered ‘a’ over ‘b’).
You will be given a string and you need to find its awesomeness.
Only line of the input will contain a string S.
Output two lines. First line should contain value of c, whereas second line should contain value of F.
Input: abbbaaabad Output: a 3
Example case 1. Example taken from problem statement
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll