0% found this document useful (0 votes)
13 views1 page

Bangle: Input

The document discusses a jewelry factory manager who wondered how many different kinds of bangles could be produced given a set number of places to inlay diamonds and a set number of diamond types. It provides an input/output example of calculating the number of possible bangle combinations for given m and n values.

Uploaded by

Hello mister
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views1 page

Bangle: Input

The document discusses a jewelry factory manager who wondered how many different kinds of bangles could be produced given a set number of places to inlay diamonds and a set number of diamond types. It provides an input/output example of calculating the number of possible bangle combinations for given m and n values.

Uploaded by

Hello mister
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

1271 Bangle

Splendid bangles inlaid with gorgeous diamonds are the special products of jewelry factories. With the
industrialization of jewelry manufacture, common bangles become cheaper than ever. But the dream
of ownning characteristic bangle becomes costlier than ever. For this reason, a jewelry factory designed
a new kind of bangle inlaid with various diamonds according to customers’ demand, which realized the
dream of ownning characteristic bangle.
But one day the manager of a jwewlry factory asked himself, “How many kinds of bangles I could
produce with the same style?” That is, if the bangle has m places to be inlaid with diamonds and he
has n kinds of diamonds to inlay, how may different kinds of bangles he could produce?
As you know, bangle is a circular jewelry. The places to be inlaid with diamonds are spaced equally
round the circle. And also, the bangle could be rotated and turned over. We assume that there are two
bangles. And we rotate and turn over a bangle for some times, then the bangle becomes the same as
another one. We should regard the two bangles as the same kind.

Input
The input file may contains serval data sets. Each data set consists of two integers m (2 < m ≤ 27−n +19)
and n (1 < n ≤ 7). The first integer m represents the number of places to be inlaid with diamonds in
the bangle. The second integer n represents the number of the kinds of the diamonds. The input file is
terminated by m = 0 and n = 0.

Output
For each data set, compute s (s < 1017 ), the number of the different kinds of the bangles could be
produced. Output your answer as a single integer on a line by itself.

Sample Input
4 3
20 7
0 0

Sample Output
21
1994807229453766

You might also like