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
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers102
Suggested Problems
-
Generate a random matrix A of (1,-1)
317 Solvers
-
964 Solvers
-
1190 Solvers
-
471 Solvers
-
Predict Cricket Stridulation Rate from Air Temperature
391 Solvers
More from this Author22
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!