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

Турниры > CEN112 Homeworks 2013-2015 > задача:


13-Fall2-20. 50395 - Page "Like" Averages

CEN112 Homeworks 2013-2015

Старт: 15.дек.2013 в 12:00:00
Финиш: 15.дек.2013 в 17:00:00
Турнир завершён!
• Турнирная таблица

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

Задачи турнира

• 50375 - Area of Circles
• 50388 - Number of Armstrong Num...
• 50393 - Palindromic Numbers
• 50339 - The Largest Rectangle
• 50345 - Orders
• 50758 - National Elections - Revisited
• 50754 - Team Standings
• 12-Spr1-40. 50327 - Parallel Lines
• 13-Fall2-20. 50395 - Page "Like...
• 14-Spr1-30. 50492 - Contest Score...
• 14-Spr1-40. 50538 - Sum of kth Dia...
• 14-Spr1-60. 50647 - Спираль
• 14-Spr2-20. 50442 - Polynomial Add...
• 14-Spr2-40. 50361 - Align Two Lists
• 14-Spr2-50. 50616 - Змейка
• 14-Spr2-60. 50444 - n digit kth nu...
• 15-SprHW-20. 50446 - Snake

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

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