Problem Statement | |||||||||||||
A wicked teacher is trying to fail one of his students. He gives him the following problem: You are given a String[] numbers containing a set of distinct integers. You can concatenate some permutation of these integers to obtain one large integer. For example, the permutation {5221, 40, 1, 58, 9} can be concatenated to form 5221401589. Find a permutation of the given numbers such that its concatenation is divisible by the integer K. The student doesn't have a clue how to solve this problem, so he just answers with some random permutation. There may be multiple correct answers, and maybe the student has chosen one of them by chance. Return the probability that the student has chosen one of the correct answers and return it as a String in the form of an irreducible fraction "p/q" (quotes for clarity), where p is the fraction's numerator and q is its denominator. Assume that each permutation has the same probability of being chosen. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | numbers will contain between 1 and 15 elements, inclusive. | ||||||||||||
- | Each element of numbers will contain between 1 and 50 characters, inclusive. | ||||||||||||
- | Each element of numbers will contain digits ('0'-'9') only. | ||||||||||||
- | Each element of numbers will begin with a non-zero digit. | ||||||||||||
- | Elements of numbers will be distinct. | ||||||||||||
- | K will be between 1 and 100, inclusive. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
|