HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Repetition (Loops) > problem:


035. 50573 - Count and Sum

Guest
• Review clarifications (2)

Volume problems

• 024. 50372 - Number Quadruplets
• 025- 2013-Nov-01. 50328 - How far ...
• 026. 50399 - Mobile Base Station
• 026. 50487 - Radius of Inscribed Circle
• 027. 50548 - Albanian Airlines
• 028. 50483 - Group Total
• 030. 50584 - Total invoice amount
• 033. 50588 - Processing the list of n...
• 035. 50573 - Count and Sum
• 040. 50335 - Five Math Operators
• 044. 50597 - Drawing Diamonds
• 045. 50462 - Class Average (3 Gra...
• 050. 50450 - Last Appereance of a ...
• 058. 50574 - Triangular Numbers
• 060. 50362 - Pythagorean Numbers
• 060. Problem 2
• 065. 50394 - Water Bills

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