2
1
Challenge: given a number, calculate how many unique, order-independent ways there are to achieve a score of that number in American Football.
Let's see how few characters can be used in each of your favorite languages! The usual rules apply. Input and output in a way that is natural to your language.
Recall that the ways to score in Football are safety (2 points), field goal (3 points), touchdown (6 points), touchdown + extra point (7 points), and touchdown + 2-point conversion (8 points).
For example, given 9 as input, the program should return 4, since you could score:
- 1 touchdown + extra point and 1 safety
- 1 touchdown and 1 field goal
- 3 field goals
- 3 safeties and 1 field goal
Note that order does not matter.
3I'm not familiar with American Football. Is the question just about ways of partitioning the number using 2,3,6,7 and 8? – swish – 2014-01-06T22:35:26.583
@swish yup! Just an actual version of the problem I found myself thinking about. – Ben Reich – 2014-01-06T22:43:42.843
4
This is essentially identical to Need change of 78 cents except for the values of some constants. (Although on reflection, since this question is better posed, it might be preferable to close the other one as a duplicate of this one).
– Peter Taylor – 2014-01-06T23:48:59.917Awhh. I watch the Canadian Football League. I want my 1 point for punting into the endzone! – Cruncher – 2014-01-07T14:22:31.500