Back
Close

Scorigami

Statement

 Goal

In NFL, the points received for certain things are not as simple, as in other sports.

A team can have (starting with the most possible, to the least possible):
- Get 7 points, 6 for a Touchdown, and 1 for an extra point T
- Get 3 points, for a Field Goal F
- Get 6 points, for a Touchdown, and failed extra point or conversion TF
- Get 8 points, for a Touchdown, and a succesful 2 point conversion TC
- Get 2 points, for a Safety S
- Get 2 points, for a Blocked Extra Point or Failed Conversion, after a Touchdown by the other team RC
- Get 1 point, for a Safety on extra point or conversion, after a Touchdown by the other team RS
The latest is something that never happened in professional football, but technically possible.

Your job is to tell how many ways a score can be achieved (order of plays doesn't matter).

The input is a score (starting with the winner team). A draw can appear, in this case order is not interesting.
The expected output is:
- The number of combinations of scores that can be reached
- Line by Line the "Code" of every possible combinations, in ABC order

The "Code" is similar to this (for 20-9): 2T1F1S1RS-1F1TF
Which means, that
- Winner team has 2 Touchdowns T, 1 Field Goal F, 1 Safety S and one Safety on an Extra Point RS
- Losing team has 1 Field Goal F, and 1 Touchdown with a failed extra point TF
You can see, that this is only possible if the losing team has a TF, because that is necessary for having an RS on the winning side.
Code is always in the order of the score possibility.


For the sake of the game, let's say scoring rules never changed (for picky guys about 1940's games as test cases).
Input
Line 1: An integer W for the point of the winning team, and an integer L for the point of the losing team, divided by a "-"
Output
Line 1 : The number of possible combinations for this score to happen N
Next N lines: The Code of the combinations, in ABC order
Constraints
2 ≤ W ≤ 100
0 ≤ L ≤ 100
LW
Example
Input
7-3
Output
2
1F2S-1F
1T-1F

Tags
CombinatoricsLoopsOptimization

Difficulty
Medium

Test cases
Example Test
Input
7-3
Output
2 1F2S-1F 1T-1F

Similar Example Validator
Input
7-7
Output
4 1F2S-1T 1F2S-1F2S 1T-1F2S 1T-1T

SuperBowl LIII Test
Input
13-3
Output
6 1F1TC1S-1F 1F5S-1F 3F2S-1F 1T1TF-1F 1T1TF-1S1RS 1T2F-1F 1T3S-1F

Validator 2 Validator
Input
13-3
Output
2 1F2S-1F 1T-1F

SuperBowl LIV Test
Input
31-20
Output
2 1F2S-1F 1T-1F

Validator 3 Validator
Input
31-20
Output
2 1F2S-1F 1T-1F

SuperBowl LII Test
Input
41-33
Output
2 1F2S-1F 1T-1F

Validator 4 Validator
Input
41-33
Output
2 1F2S-1F 1T-1F

SuperBowl XLVIII Test
Input
43-8
Output
2 1F2S-1F 1T-1F

Validator 5 Validator
Input
43-8
Output
2 1F2S-1F 1T-1F

Impossible score Test
Input
2-1
Output
0

Validator 6 Validator
Input
3-1
Output
0

Jets/Titans 2014 Test
Input
16-11
Output
2 1F2S-1F 1T-1F

Validator 7 Validator
Input
16-11
Output
2 1F2S-1F 1T-1F

Saints/Packers 2008 Test
Input
51-29
Output
2 1F2S-1F 1T-1F

Validator 8 Validator
Input
51-29
Output
2 1F2S-1F 1T-1F

Cowboys/Lions 1970 Test
Input
5-0
Output
2 1F2S-1F 1T-1F

Validator 9 Validator
Input
5-0
Output
2 1F2S-1F 1T-1F

1940 NFL Championship Game Test
Input
73-0
Output
2 1F2S-1F 1T-1F

Validator 10 Validator
Input
73-0
Output
2 1F2S-1F 1T-1F

Jets/Cardinals 2008 Test
Input
56-35
Output
2 1F2S-1F 1T-1F

Validator 11 Validator
Input
56-35
Output
2 1F2S-1F 1T-1F

The only 4 point game Test
Input
10-4
Output
2 1F2S-1F 1T-1F

Validator 12 Validator
Input
10-4
Output
2 1F2S-1F 1T-1F

Test 13 Test
Input
3-3
Output
2 1F2S-1F 1T-1F

Validator 13 Validator
Input
3-3
Output
2 1F2S-1F 1T-1F

Test 14 Test
Input
3-3
Output
2 1F2S-1F 1T-1F

Validator 14 Validator
Input
3-3
Output
2 1F2S-1F 1T-1F

Test 15 Test
Input
3-3
Output
2 1F2S-1F 1T-1F

Validator 15 Validator
Input
3-3
Output
2 1F2S-1F 1T-1F

Test 16 Test
Input
3-3
Output
2 1F2S-1F 1T-1F

Validator 16 Validator
Input
3-3
Output
2 1F2S-1F 1T-1F

Test 17 Test
Input
3-3
Output
2 1F2S-1F 1T-1F

Validator 17 Validator
Input
3-3
Output
2 1F2S-1F 1T-1F

Test 18 Test
Input
3-3
Output
2 1F2S-1F 1T-1F

Validator 18 Validator
Input
3-3
Output
2 1F2S-1F 1T-1F

Test 19 Test
Input
3-3
Output
2 1F2S-1F 1T-1F

Validator 19 Validator
Input
3-3
Output
2 1F2S-1F 1T-1F

Test 20 Test
Input
3-3
Output
2 1F2S-1F 1T-1F

Validator 20 Validator
Input
3-3
Output
2 1F2S-1F 1T-1F

Solution language

Solution

Stub generator input
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants