HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Forums > Discussion of problems > topic:


Problem "50511 - Class Average"

There is a contest!

В настоящий момент идёт турнир. Некоторая информация и функции сервера недоступны до его окончания.

imesecanSep.17.2015 at 04:58:54 PM
0--- Test Case 1 ---
12A Evis Visari 64
12C Ilir Drita 36
12A Eva Hoxha 43
12C Arban Reka 100
12A Albana Visari 55

--- Pattern ---
12C 68

imesecanNov.13.2015 at 11:43:23 AM
1We need to calculate the sum of grades of two classes and divide by the number of students in that class. So, we need 3 variables for each class: cName, char array; sum of the grades and nrStudents in this class. class1 is char array, sum1=0, nrSt1=0;
So, we read the first class className and increment sum1 with the grade of the first student and inc nrSt by 1.

Then for the other 4 lines of information. We read the information, and compare the className we read with the class1, if they're the same, then add this grade to sum1, and increment nrSt1. Otherwise, assign the className to the class2 and then add this grade to sum2, increment nrSt2.

In the end, compare the averages and show, the name and average of the bigger one

imesecanDec.20.2015 at 10:02:57 AM
2Pay attention that the class average has to be a floating point number

imesecanDec.20.2015 at 10:57:33 AM
3--- Test 2 ---
12B Arnold Avdyli 44
12B Anisa Bega 78
12A Lenci Bega 46
12A Andi Ulqinaku 48
12B Mondi Capuni 37

--- pattern ---
12B 53

imesecanDec.22.2015 at 06:30:59 AM
4--- Test 3 ---
12B Lenci Tervolli 28
12C Enis Veizi 17
12C Anisa Drita 99
12C Eva Agolli 5
12B Evis Dokja 15

--- pattern ---
12C 40.33


www.contester.ru