Statistics

Problem Statement for "NFL"

Problem Statement

PROBLEM STATEMENT
You and your friend turn on the big football game in the middle of the third
quarter and find that the score is 16-12.  In the NFL this is a very unusual
score and you and your friend wonder how that score came to be.  Was it missed
extra points, made two-point conversions, or safeties?  You are to implement a
class where given the score of a team, you return the number of possible ways
that score could have been reached.  Here, order is unimportant - a touchdown
then a field goal is the same as a field goal then a touchdown.

Here is the scoring scheme in football:
(a)  A safety is worth 2 points
(b)  A field goal is worth 3 points
(c)  A touchdown is worth 6 points, but after a touchdown is scored:
     (i)  A team may try a PAT worth one point
     (ii) A team may try a two-point conversion worth two points
** The team can make or miss either (after the touchdown, they are not
guaranteed either conversion)

Also, a PAT or two-point conversion cannot be made any time except after a
touchdown has been scored.

In simpler terms, there are 5 ways to score: safety (2), field goal (3),
touchdown (6), touchdown + PAT (7), touchdown + two-point conversion (8).

DEFINITION
Class Name: NFL
Method Name: numWays
Parameters: int
Returns: int

Method signature (be sure your method is public): int numWays(int score);


TopCoder will ensure that:
- score will be a number between 1 and 99 inclusive.


EXAMPLES
1. If score=12
- There are 8 possible ways to get 12 points:
  (1)  6 safeties
  (2)  3 safeties, 2 field goals
  (3)  3 safeties, 1 touchdown (with a missed PAT or missed two-point conversion)
  (4)  2 safeties, 1 touchdown + two-point conversion
  (5)  1 safety, 1 field goal, 1 touchdown + PAT
  (6)  4 field goals
(7)  2 field goals, 1 touchdown (with a missed PAT or missed two-point
conversion)
  (8)  2 touchdowns (with missed PAT's or missed two-point conversions)
Your method should return 8.

2. If score=16
- There are 14 possible ways to get 16 points:
  (1)  8 safeties
  (2)  5 safeties, 2 field goals
  (3)  5 safeties, 1 touchdown (no conversion)
  (4)  4 safeties, 1 touchdown with two-point conversion
  (5)  3 safeties, 1 field goal, 1 touchdown with PAT
  (6)  2 safeties, 4 field goals
  (7)  2 safeties, 2 field goals, 1 touchdown (no conversion)
  (8)  2 safeties, 2 touchdowns (no conversions)
  (9)  1 safety, 2 touchdowns with PATs
  (10) 1 safety, 2 field goals, 1 touchdown with two-point conversion
(11) 1 safety, 1 touchdown (no conversion), 1 touchdown with two-point
conversion
  (12) 3 field goals, 1 touchdown with PAT
  (13) 1 field goal, 1 touchdown (no conversion), 1 touchdown with PAT
  (14) 2 touchdowns with two-point conversions
Your method should return 14.

3. If score=6, your method should return 3.
4. If score=14, your method should return 11.
5. If score=21, your method should return 25.

Definition

Class:
NFL
Method:
numWays
Parameters:
int
Returns:
int
Method signature:
int numWays(int param0)
(be sure your method is public)

Constraints

    Examples


      This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
      This problem was used for: