ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Сборники > Kovrov IT > задача:


50395 - Page "Like" Averages

Гость
• Вопросы к жюри (1)

Задачи сборника

• 50304 - Number Pattern
• 50322 - Snake Pattern
• 50321 - Missing Number
• 50317 - Student Line Up
• 50311 - Student Line Up
• 50384 - Permutations revisited
• 50841 - My grand-grand-grandfather
• 50380 - Sum of the Numbers in the ...
• 50395 - Page "Like" Averages
• 50332 - Variance of a series
• 50398 - Sum of kth Anti-diagonal
• 50323 - Filtering Contact List
• 50400 - nth Row rth Element of a Table
• 50364 - Student averages
• 50410 - Zero Padding
• 50407 - Missing Number
• 50337 - Exam Averages

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Prepared by Ibrahim Mesecan.

Page "Like" Averages

A web site has contacted you to prepare a list for the most liked pages. The users can rate every page between 1 and 5. Currently web admin stores the following information in an array.

  • Unique id: An auto incremented integer
  • Page ID: Every page has a unique ID; integer not greater than 2000
  • Rating: an integer between 1 and 5, given by users
  • IP adress of the user rated: 15 char string; (at most three digits) 4 integers separated by three periods

Question:
Write a program that is going to read rating information given by users And then, calculate the like average of every page.

Input specification
The first line contains an integer number (n), the number of ratings in the file where n is between 1 and 10000. The following n lines contain rating information as described above.

Output specification
Show existing page IDs followed by the page averages (with 2 decimal places after the floating point).

 Sample Input I   
  7
  1 3 3 119.138.140.197
  2 4 1 110.158.121.79
  3 3 3 142.190.164.60
  4 5 3 105.187.168.146
  5 4 4 107.120.121.124
  6 6 2 118.197.154.183
  7 3 4 142.190.164.60
 Sample Output I   
  3 3.33
  4 2.5
  5 3
  6 2
 Sample Input II   
  8
  1 2 1 126.176.189.21
  2 1 3 131.172.181.60
  3 6 5 123.132.179.120
  4 7 2 108.115.183.218
  5 1 5 119.154.152.107
  6 3 1 114.176.160.128
  7 5 2 124.125.91.158
  8 1 2 145.179.130.157
 Sample Output II   
  1 3.33
  2 1
  3 1
  5 2
  6 5
  7 2


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

www.contester.ru