CodeSprintLA 2020 — Individual Competition

#### Start

2020-05-23 13:00 AKDT

## CodeSprintLA 2020 — Individual Competition

#### End

2020-05-23 15:30 AKDT
The end is near!
Contest is over.
Not yet started.
Contest is starting in -726 days 11:32:17

2:30:00

0:00:00

# Problem FBracelet Making

You are a UCLA student braiding bracelets for charity.

There are $2$ colors of beads to choose from, $B$ blue beads and $G$ gold beads.

You have to use all beads provided.

How many unique bracelets can you make?

We define equivalence, and thus uniqueness, of bracelets below:

We represent a bracelet $b$ of length $n$ by a sequence $b_1$, $b_2$, $\dotsc$, $b_ n$ of colors.
The rotation of a bracelet $b$ is another bracelet $c$ such that $c_ i = b_{i+1}$ for $1\leq i<n$ and $c_ n=b_1$.
The reflection of a bracelet $b$ is another bracelet $c$ such that $c_ i = b_{n+1-i}$ for $1\leq i \leq n$.
Two bracelets are considered equivalent if there is a sequence of rotations and reflections that can be applied to the first bracelet to get the second one.

For example:

## Input

Two non-negative integers, $B$ and $G$, such that $B$ and $G$ sum up to a prime number less than $20$.

## Output

Single integer representing the number of possible ways to make bracelets given $B$ and $G$.

## Output Visualization

For a bracelet with $2$ gold and $5$ blue beads, these are the only possible unique bracelets you can have:

Sample Input 1 Sample Output 1
3 2

2

Sample Input 2 Sample Output 2
5 2

3

Sample Input 3 Sample Output 3
12 7

1368