Question Details

[solution]: Case 25.1 Harwood Medical Intruments PLC This case asks you to


Answer download
More Details:

My code is not generating the correct output. Please have a look and correct.


Beginner's Luck

 

Filename: luck

 

It always seems that beginners have amazing luck. Just last week you showed your friend Liliana

 

a video game that you had been playing for over a year. On her first try, her score was better than

 

your average score!!!

 

Now, you and Liliana have gotten into a discussion about whether beginners really are lucky.

 

Luckily, you have data about many individuals playing the video game. For each individual, you'd

 

like to make a claim of the form:

 

In their first X games, [Insert Name Here] scored an average of Y points per game.

 

To make the claim as impressive as possible, you'd like to maximize the value of Y, given the

 

player's full game history, over all possible positive integers for X.

 

For example, if Michael had gotten the following scores (in this order):

 

10, 8, 9, 15, 12, 2, 3, 8, 7, 11

 

we see that the best claim we can make is that in the first 5 games, Michael averaged a score of

 

(10 + 8 + 9 + 15 + 12)/5 = 10.8 points per game. (Note that each of the running averages, rounded

 

to one decimal place are 10.0, 9.0, 9.0, 10.5, 10.8, 9.3, 8.4, 8.4, 8.2, and 8.5, respectively.)

 

The Problem:

 

Given a list of positive integers, determine the maximum average of any non-empty prefix of the

 

list.

 

The Input:

 

The first line of input contains a single positive integer, n (n ? 100), the number of input cases to

 

be processed. Each input cases follows, one per line. For each input case, the first number is a

 

positive integer, k (k ? 1000000), representing the number of times the player for the input case

 

has played the video game. The following k space-separated integers represent the player's scores

 

for each time playing the video game, in order. Each of these integers will be in between 0 and

 

1000, inclusive.

 

The Output:

 

For each test case, on a line by itself, output the maximal average of any of the first m (1 ? m ? k)

 

games, rounded to 6 decimal places.

 


 

Sample Input:

 

2

 

10

 

8

 

9

 

15

 

12

 

2

 

3

 

8

 

7

 

11

 

3

 

3

 

2

 

1

 


 

Sample Output:

 

10.800000

 

3.000000

 


 

 


Solution details:
STATUS
Answered
QUALITY
Approved
ANSWER RATING

This question was answered on: Dec 18, 2020

PRICE: $18.50

Solution~00031148033943.zip (25.37 KB)

Buy this answer for only: $18.50

This attachment is locked

We have a ready expert answer for this paper which you can use for in-depth understanding, research editing or paraphrasing. You can buy it or order for a fresh, original and plagiarism-free copy (Deadline assured. Flexible pricing. TurnItIn Report provided)

Pay using PayPal (No PayPal account Required) or your credit card . All your purchases are securely protected by .
SiteLock

About this Question

STATUS

Answered

QUALITY

Approved

DATE ANSWERED

Dec 18, 2020

EXPERT

Tutor

ANSWER RATING

GET INSTANT HELP/h4>

We have top-notch tutors who can do your essay/homework for you at a reasonable cost and then you can simply use that essay as a template to build your own arguments.

You can also use these solutions:

  • As a reference for in-depth understanding of the subject.
  • As a source of ideas / reasoning for your own research (if properly referenced)
  • For editing and paraphrasing (check your institution's definition of plagiarism and recommended paraphrase).
This we believe is a better way of understanding a problem and makes use of the efficiency of time of the student.

NEW ASSIGNMENT HELP?

Order New Solution. Quick Turnaround

Click on the button below in order to Order for a New, Original and High-Quality Essay Solutions. New orders are original solutions and precise to your writing instruction requirements. Place a New Order using the button below.

WE GUARANTEE, THAT YOUR PAPER WILL BE WRITTEN FROM SCRATCH AND WITHIN YOUR SET DEADLINE.

Order Now