TopcoderArchive
Archive22 Aug 2006
TCCC06 Round 2A

MatchCounts

Problem statement, definition, constraints, and public examples.

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

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