F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

The Three Groups

Time 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
2 3 4 1 1 1 0 0 0
 

Sample Output
7 4 Note: The valid solutions for the second sample input-output are as following: 2*3 =6 2*4 =8 3*2 =6 4*2 =8
 

Author
Muhammed Hedayet
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-21 14:37:52, Gzip enabled