Back
Close
  • 65

What will I learn?

Combinatorics

Statement

 Goal

In recent years a very old game has become more and more famous: Mölkky. This authentic Finnish game that combines skill and luck. The goal is simple. Players must throw a wooden cylinder called Mölkky, in order to knock down the pin group (on which numbers 1-12 are written) located 3 or 4 meters from the pitcher to score points and reach exactly 50 points.

Points are counted in this way:
-If a player drops only one pin, he scores the number of points written on that pin.
-If a player knocks down more than one pin, he marks the number of pins knocked down.

The purpose of this puzzle is to know how many possibilities there are to make 50 points from an initial score.

Example (When P is placed in front of a number means that only one pin has fallen and the number following the letter P is the number written on the pin, on the contrary when the number is not accompanied it means the number of keels dropped, the spaces represent a round, each turn, all pins are put back in place)
If we start from a score of 47 then the possibilities are:
P1 P1 P1 
P2 P1
P1 P2
2 P1
P1 2
P3
3

That is, 7 possibilities

Finally, the possibilities must not exceed 4 rounds, otherwise, the player would take too long to succeed and risk losing the game.
Input
¤An integer N that matches the initial score
Output
¤An integer corresponding to the number of possibilities to reach 50 from the initial score and in 4 rounds or less
Constraints
¤Number of rounds<=4
¤We will consider that a round will necessarily earn points, it is impossible for a round to be void.
Example
Input
47
Output
7
Solve it

A higher resolution is required to access the IDE

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