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

Разделы > Поиск > задача:


51059 - Football teams

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

Задачи раздела

• 50862 - Sum of the Pairs
• 50238 - The smallest number
• 51059 - Football teams
• 51058 - Third grade students
• 51060 - Public Transportation
• 50483 - Group Total
• 50331 - Number of Numbers over A...
• Raporti Javor
• 50861 - The largest Student Group
• 50815 - Breaking the Bunker
• 50437 - Age Labeling

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

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

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
bfs.

Q6

Write a program which reads the statistics of n League A football teams  and prints the teams name which fall in League B.

A team falls in League B, if it has less than k points after having played m weeks where m is between 1 and 150. Each team gets three points for a win, one point for draw and zero points when lost.

 

Input Specification: In the first line, you will be given the number of teams 0 < n ≤ 500 and the points 0 < k ≤ 300 needed to stay in league A. Then in the following n lines, there will be the team name and its results. Semicolon indicates the end of input series.

Number 2 represents win, number one represents draw and number zero represents loss.

Output Specification: Show the team names and their points which fall to League B.

If no team falls to League B than show "0 Teams" message.

Sample Input I
4 19
Team_A 1 1 1 1 1 1 1 1 1 0 1 1 1 0 2 1 0 ;
Team_B 0 1 0 2 2 1 1 0 1 1 0 2 0 1 0 0 2 ;
Team_C 0 0 1 0 2 2 2 1 1 1 1 1 0 0 2 1 2 ;
Team_D 0 1 0 1 2 1 2 1 0 0 0 2 2 2 0 0 0 ;
Sample Input II
4 15
Team_001 0 2 2 1 1 2 0 2 0 2 2 0 1 1 ;
Team_002 0 2 1 2 0 0 1 0 1 1 0 1 2 1 ;
Team_003 0 2 1 2 0 1 0 2 0 0 1 0 1 2 ;
Team_004 1 0 2 0 0 1 1 2 0 0 2 1 2 0 ;
 Sample Output I
Team_A 16
Team_B 18
 Sample Output II
0 Teams

 Sample Input I Explanation: 

Team_A has: (1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 3 + 1 + 0)= 16 points,
Team_B has: (0 + 1 + 0 + 3 + 3 + 1 + 1 + 0 + 1 + 1 + 0 + 3 + 0 + 1 + 0 + 0 + 3)= 18 points,
Team_C has: (0 + 0 + 1 + 0 + 3 + 3 + 3 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + 3 + 1 + 3)= 22 points,
Team_D has: (0 + 1 + 0 + 1 + 3 + 1 + 3 + 1 + 0 + 0 + 0 + 3 + 3 + 3 + 0 + 0 + 0)= 19 points.

So Team_A and Team_B with 16 and 18 points respectively fall in league B.

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

www.contester.ru