03. Numbers 02. Programming Fundamentals Mid Exam JavaScript
Здравейте,
За съжаление получавам на тази задача само 80/100 точки. Някой има ли някаква идея каква точно може да е причината?
Това е решението което имам:
Тук може да видите условието:
Write a program to read a sequence of integers and find and print the top 5 numbers greater than the average value in the sequence, sorted in descending order.
Input
· Read from the console a single line holding space-separated integers.
Output
· Print the above-described numbers on a single line, space-separated.
· If less than 5 numbers hold the property mentioned above, print less than 5 numbers.
· Print "No" if no numbers hold the above property.
Constraints
· All input numbers are integers in the range [-1 000 000 … 1 000 000].
· The count of numbers is in the range [1…10 000].
Examples
Input Output Comments
'10 20 30 40 50' 50 40 Average number = 30. Numbers greater than 30 are: {40, 50}. The top 5 numbers among them in descending order are: {50, 40}. Note that we have only 2 numbers, so all of them are included in the top 5.
'5 2 3 4 -10 30 40 50 20 50 60 60 51' 60 60 51 50 50 Average number = 28.08. Numbers greater than 20.078 are: {30, 40, 50, 50, 60, 60, 51}. The top 5 numbers among them in descending order are: {60, 60, 51, 50, 50}.
'1' No Average number = 1. There are no numbers greater than 1.
'-1 -2 -3 -4 -5 -6' -1 -2 -3 Average number = -3.5. Numbers greater than -3.5 are: {-1, -2, -3}.
Благодаря предварително!
Много благодаря!