1
If a game can result in a win, worth one point; a draw, worth half a point; or a loss, worth no points; how many ways are there of scoring k
points in n
games?
Applicable scenarios include NFL and chess.
- Input is via stdin, and consists of
n
andk
on separate lines. n
will be a non-negative integer.(n ≤ 16)
k
will be either a non-negative integer or a non-negative integer plus a half.(k ≤ n)
- Output is to stdout. It may, but does not have to, include a trailing newline.
Test cases
In each case, the first two lines are user-supplied input and the third line is the program output.
10
4.5
8350
16
8
5196627
16
13.5
13328
12
12
1
4http://oeis.org/A027907 – Peter Taylor – 2013-06-19T17:37:20.370
This is very insightful. I have a working solution in c# which compiles to the requirements outlined within the problem. I'm merely curious if someone can come up with a more compact solution than what I have. Cheers! – glthomas – 2013-06-19T20:07:41.807