|
||||||||||
The Three GroupsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 812 Accepted Submission(s): 393 Problem Description There appeared in ¡°Nouvelles Annales de Mathematiques¡± the following puzzle as a modification of any of my ¡°Canterbury Puzzles.¡± Arrange the nine digits in three groups of two, three, and four digits, so that the first two numbers when multiplied together make the third. Thus, 12 * 483 = 5,796. I now also propose to include the cases where there are one, four and four digits, such as 4 * 1,738 = 6,952. Can you find all possible solutions in both cases?¡±- Amusement in Mathematics, by Ernest Dudeney. Now we want to arrange some of the nine digits (without ¡®0¡¯) in three groups of a, b and c digits, so that the first two numbers when multiplied together make the third. In addition, no digit can be used more than once in a single multiplication. You have to find how many solution exist there for given a, b and c. Input There are multiple test cases. In addition, each test case is consisting of three integers a, b, c separated by spaces.(a , b , c >= 0 && a + b + c <= 9) Meaning of a, b, and c are described in the problem statement. The last case contains exactly three 0¡¯s for all of a, b, c and indicates the end of input stream. This line should not be processed. Output Your program should print a single integer for each input in a single line. The integer will state that how many solution there are for the given size of a, b and c. Sample Input
Sample Output
Author Muhammed Hedayet Source | ||||||||||
|