FoxMakingDiceEasy
Member SRM 491 · 2010-03-12 · by wrong
Problem Statement
Fox Jiro likes dice. He wants to make his own dice. Each die he wants to make is a cube. Each of the 6 faces has an integer between 1 and N, inclusive. No two faces have same number. Also the following condition must be satisfied: for all faces, the sum of the numbers on opposite faces must be equal and the sum must be greater than or equal to K.
He realized that there are many ways to make such dice. He wants to know how many ways there are. Please help Jiro to make a program that is given two integers N and K and returns the number of different dice satisfying the condition mentioned above.
Two dice are considered the same if you can rotate one to form the other.
Notes
- The answer will always fit in a signed 32-bit integer.
Constraints
- N will be between 1 and 50, inclusive.
- K will be between 1 and 100, inclusive.
6 7 Returns: 2
You can make normal dice. There are two ways to arrange the numbers.
5 7 Returns: 0
You cannot make 6 sided dice with 5 numbers.
50 1 Returns: 105800
31 46 Returns: 504
10 10 Returns: 48
Submissions are judged against all 74 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class FoxMakingDiceEasy with a public method int theCount(int N, int K) · 74 test cases · 2 s / 256 MB per case