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

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


50395 - Page "Like" Averages

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

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

• 50382 - Parkside's Other Triangle
• 50413 - Valid Permutations
• 50406 - Draw Pattern 178
• 50861 - The largest Student Group
• 50418 - Student averages
• 50420 - Teachers Sightseeing
• 50384 - Permutations revisited
• 50841 - My grand-grand-grandfather
• 50395 - Page "Like" Averages
• 50407 - Missing Number
• 50516 - Lines
• 50446 - Snake
• 50875 - Take m-out
• 50509 - Reading Book
• 50529 - Row to Table
• 50786 - Top Question
• 50788 - Eight Puzzle

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

Если у вас есть предложения или пожелания по работе 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