Problem L
Arif in
Input: standard input
Output: standard output
Time Limit: 2 seconds
Our hero Arif is now in
a) All necklace/bracelet
construction sets has a frame, which has N
slots to place N beads.
b) All the slots must be filled to make a necklace/bracelet.
c) There are t types of beads in a set. N
beads of each type are there in the box. So the total number of beads is tN (t multiplied by N), of
which exactly N can be used at a
time.
The figure above shows necklaces for some different values of N (Here, t is always 2). Now
let’s turn out attentions to bracelets.
A bracelet is a necklace
that can be turned over (A junior programmer in Bangladesh says that wrist
watch is a necklace (Boys!!! Don’t
mind :-))). So for a bracelet the
following two arrangements are equivalent. Similarly, all other opposite
orientation or mirror images are equivalent.
So, given the description of a necklace/bracelet
construction set you will have to determine how many different necklace and
bracelet can be formed with made with that set
Input
The input file contains several lines of input. Each line contains two positive integers N(0<N<51) and t(0<t<11) as described in the problem statement. Also note that within this input range inputs will be such that no final result will exceed 11 digits. Input is terminated by end of file.
Output
For each line of input produce one line of output which contains two round numbers NN and NB separated by a single space, where NN is the number of total possible necklaces and NB is the number of total possible bracelets for the corresponding input set.
Sample Input
5 2
5 3
5 4
5 5
Sample
Output
8 8
51 39
208 136
629 377
(Math Lovers’ Contest,
Problem Setter: Shahriar Manzoor)