0

We have 16 teams and 2 grounds. Both 2 grounds available for 60 min on Monday and 120 min on Tuesdays. That means 2 matches can be possible on Monday and 4 matches on Tuesday. If one team can not play the match again on the same day how many matches can be possible on Monday and Tuesday respectively.

Hint:-

  1. No of matches for N number of teams, = (N-1)+(N-2)+(N-3)+(N-4).....+(N-N) example for 16 teams (16-1)+(16-2)+(16-3)....+(16-16)= 120 Matches

How can we find the formula for the N number of teams and N number of grounds? I am asking about an optimal solution so I can find minimum days to complete all the matches.

Satanand Tiwari
  • 486
  • 4
  • 21
  • 1
    How is this related to programming? – MBo Mar 04 '21 at 05:46
  • I have to write an algorithm for this. I have to write a code for the match fixture applicaiton. Does it make sence? @MBo – Satanand Tiwari Mar 04 '21 at 05:49
  • Probably you have to introduce some restrictions. There is a multitude of solutions. Say 120 matches Tuesday and 0 Monday, or 60 and 60, etc – Yuri Ginsburg Mar 04 '21 at 07:47
  • @YuriGinsburg You are right. I am asking about an optimal solution so I can find minimum days to complete all the matches. I am adding this to the question. Thanks – Satanand Tiwari Mar 04 '21 at 07:56

2 Answers2

1
from itertools import combinations 
  
# Get all combinations of 16 teams and length 2
# Formula for combination is Nc2 = ((N)*(N-1))/2)

total_no_match = combinations([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16], 2)
total_no_match = list(total_no_match)
total_no_match = [str(total_no_match) for total_no_match in total_no_match]
print("Total number of matches:", len(total_no_match))

# On Monday 2 Matches and on Tuesday 4 Matches can be played. So total no of matches played in a week = 6

m = 2
t = 4

# Total no weeks required to complete 120 match:

total_week = (len(total_no_match))/(m+t)
total_week = int(total_week)
print("Total week required to complete {} match:".format(len(total_no_match)), total_week)

# No of matches on Monday:
total_match_on_monday = total_week*m
print("Total number of Match on Monday:", total_match_on_monday)

# No of matches on Monday:
total_match_on_tuesday = total_week*t
print("Total number of Match on Tuesday:", total_match_on_tuesday)

Output:

Total number of matches: 120

Total week required to complete 120 match: 20

Total number of Match on Monday: 40

Total number of Match on Tuesday: 80

Ekanshu
  • 69
  • 1
  • 11
1

We can simply use the formula of N×(N-1)/2 (Robin Round tournament ) to calculate the total number of matches, which gives us the answer 120 in this case.

As mentioned, there are 6 matches possible in a week, so it will take 20 for 120 matches.

2 on Monday and 4 on Tuesday meaning 40 on Mondays and the remaining 80 on Tuesdays for 20 weeks.