TopcoderArchive
SRM29 May 2007
SRM 351

RoomNumber

Problem statement, definition, constraints, and public examples.

Problem Statement

You are going to stick the number of your room on the door. The shop near your house suggests wonderful sets of plastic digits. Each set contains exactly ten digits - one of each digit between 0 and 9, inclusive. Return the number of sets required to write your room number. Note that 6 can be used as 9 and vice versa.

Definition

Class:
RoomNumber
Method:
numberOfSets
Parameters:
int
Returns:
int
Method signature:
int numberOfSets(int roomNumber)
(be sure your method is public)

Constraints

  • roomNumber will be between 1 and 1,000,000, inclusive.

Examples

  1. 122
    Returns: 2
    Two sets are required because each set contains only one '2' digit.
  2. 9999
    Returns: 2
    Each set contains one '6' digit and one '9' digit. '6' could be used as '9' and therefore two sets are enough.
  3. 12635
    Returns: 1
  4. 888888
    Returns: 6
Back to all problems