Advertisement
Korotkodul

Gazprom_N5_my_sol_v2

Mar 21st, 2023 (edited)
679
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.33 KB | None | 0 0
  1. n = int(input())
  2. team_name = {}
  3. team_win = {}
  4.  
  5. """
  6. 8
  7. Надежда Анна Павел
  8. Андрей Дарья Лука
  9. Илья Анна Павел
  10. Илья Аркадий Павел
  11. Лука Дарья Андрей
  12. Кристина Лука Жора
  13. Надежда Жора Кристина
  14. Кристина Мария Анна
  15. """
  16.  
  17.  
  18. for i in range(n):
  19.     a = input().split() #после input - забыл скобки ()
  20.     team = a[0] + a[1] + a[2]
  21.  
  22.     """
  23.    print("ITEREATION")
  24.    print("a")
  25.    print(a)
  26.    print("team")
  27.    print(team)
  28.    print()
  29.    """
  30.    
  31.     if team not in team_name.keys():#исправление: заменил два if-а на один
  32.         team_name[team] = a
  33.         team_win[team] = 1
  34.     else:
  35.         team_win[team] += 1
  36.  
  37.     """
  38.    print("team_name")
  39.    print(team_name)
  40.    print("team_win")
  41.    print(team_win)
  42.    print("END")
  43.    print()
  44.    """
  45.  
  46.  
  47. """
  48. debug
  49. """
  50.  
  51.  
  52.  
  53.  
  54. """
  55. debug
  56. """
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64. res = []
  65. for team in team_name.keys():
  66.     item = []
  67.     item.append(0)
  68.     item.append(0)
  69.     item[0] = team_win[team]#исправление - исправил индексы
  70.     item[1] = team_name[team]
  71.     res.append(item)
  72.  
  73. res = sorted(res)
  74. winner = res[len(res) - 1]
  75.  
  76. winner_name = sorted(winner[1])
  77. print(winner_name, ":", winner[0])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement