TopCoder problem "MatchCounts" used in TCCC06 Round 2A (Division I Level One)



Problem Statement

    The digit d will appear in element i of ability if person i can perform task d. You are required to assign each of the given people to exactly one of the 6 tasks (numbered '0' through '5'). Two people cannot be assigned to the same task. Return the number of assignments possible. Two assignments differ if there is a person who is assigned a different task in each assignment.
 

Definition

    
Class:MatchCounts
Method:howMany
Parameters:String[]
Returns:int
Method signature:int howMany(String[] ability)
(be sure your method is public)
    
 

Constraints

-ability will contain between 1 and 6 elements, inclusive.
-Each element of ability will contain between 1 and 6 characters, inclusive.
-Each character in ability will be a digit between '0' and '5', inclusive.
-No character will appear more than once in a single element of ability.
 

Examples

0)
    
{"045"}
Returns: 3
Person 0 can perform 3 different tasks.
1)
    
{"01","23"}
Returns: 4
Two choices for person 0 and two choices for person 1.
2)
    
{"01","01"}
Returns: 2
Both people have two choices, but not all 2*2 possibilities are feasible.
3)
    
{"0","0"}
Returns: 0
4)
    
{"012345","012345","012345","012345","012345","012345"}
Returns: 720

Problem url:

http://www.topcoder.com/stat?c=problem_statement&pm=4798

Problem stats url:

http://www.topcoder.com/tc?module=ProblemDetail&rd=10110&pm=4798

Writer:

AdminBrett

Testers:

PabloGilberto , brett1479 , radeye , Olexiy

Problem categories:

Recursion