Problem 56195. Possible Rugby Scores

Given a natural number s (> 4), representing a rugby team's score, return an n-by-3 matrix representing all n possible combinations of tries, conversions, and penalties (or drop goals) that would result in such a score. The first column of the matrix represents the number of tries, the second column the number of conversions, the third column the number of penalties or drop goals. The order of the rows is not important, as long as all possibilities are uniquely represented.
In rugby, a try scores 5 points, a conversion scores 2, and a penalty or drop goal scores 3. However, a conversion can only be attempted after scoring a try. Hence the number of conversions can never be more than the number of tries.
tcp = scorebreakdown(12)
tcp =
2 1 0
0 0 4
Two tries = 2*5 = 10 points. One conversion = 2 points. Total = 10 + 2 = 12.
Four penalties = 4*3 = 12 points.
Note that 1 try, 2 conversions, and 1 penalty would total 12 points, but is not allowed because it is not possible to have more conversions than tries.
(This problem can be treated as finding all integer linear combinations of 5, 2, and 3, such that 5a + 2b + 3c = s, but with a restriction: b <= a.)

Solution Stats

56.98% Correct | 43.02% Incorrect
Last Solution submitted on Feb 15, 2024

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers91

Suggested Problems

More from this Author22

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!