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

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


50065 - Page "Like" Averages

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

• 50023 - Missing Number
• 50024 - Snake Pattern
• 50026 - Variance of a series
• 50030 - Exam Averages
• 50032 - 100 Factorial
• 50046 - Student averages
• 50053 - kth Permutation
• 50057 - Parkside's Other Triangle
• 50065 - Page "Like" ...
• 50068 - Sum of kth Anti-diagonal
• 50072 - Draw Pattern 178
• 50073 - Missing Number
• 50076 - Zero Padding
• 50077 - Valid Permutations
• 50080 - Student averages
• 50090 - Row Min Subtraction
• 50098 - Cryptography

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

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