HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Repetition (Loops) > problem:


035. 50573 - Count and Sum

Guest
• Review clarifications (2)

Volume problems

• 018. 50787 - Expected Value
• 020. 50485 - Center of gravity of a ...
• 024. 50372 - Number Quadruplets
• 025- 2013-Nov-01. 50328 - How far ...
• 026. 50487 - Radius of Inscribed Circle
• 027. 50548 - Albanian Airlines
• 028. 50483 - Group Total
• 033. 50588 - Processing the list of n...
• 035. 50573 - Count and Sum
• 044. 50597 - Drawing Diamonds
• 058. 50574 - Triangular Numbers
• 072. 50473 - Counting Circles Positions
• 118. 50514 - Bookkeeping
• 125. 50484 - Number Of Letters
• 132. 50504 - School contest
• 136. 50443 - Dajte Express
• 147. 50553 - Divisible by m

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Prepared by Ibrahim Mesecan.

Count and Sum

Shqip

The school Math professor wants to see his class average and the percentage of the class who are over certain grade value (k). In order to make these calculations, he has prepared a sheet for the grades and he wants to count the number of students who have taken over the certain grade (k) and the sum of those grades (to use in future average calculations).

You will be first given two numbers (k, n) which are followed by a series of integers (n space-separated positive values). Count the numbers and calculate the sum of those numbers as far as the numbers in the series are greater than the given value (k).

Input specification
You will be given two integers (k and n) in the first line,   1 ≤ k ≤ 10 and 1 ≤ n ≤ 10.000. The second line contains a series of integer numbers a[n] where   0 < a[n] ≤ 10.

Output specification
You will give only two integer numbers cnt and sum where
   cnt is the number of numbers which are greater than the given number k; and
   sum is the sum of those numbers.
Clearly, if there is no number satisfying the given condition, cnt and sum will have the values 0 (zero).

Sample Input I
7 5
5 8 4 9 3           

Sample Output I
2 17
Explanation of the Output:
There are two numbers greater than 7 and their sum is 17.
Sample Input II
7 7
4 10 8 5 8 9 7

Sample Output II
4 35



Для отправки решений необходимо выполнить вход.

www.contester.ru