TopcoderArchiveVisit Topcoder
SRM22 Jul 2006
SRM 312

EsperantoNumbers

Problem statement, definition, constraints, and public examples.

Problem Statement

Numbers are far easier to spell in Esperanto than in English. Numbers 1 through 10 are spelled as follows: "unu", "du", "tri", "kvar", "kvin", "ses", "sep", "ok", "nau", "dek". Numbers 11 through 19 are spelled: "dek unu", "dek du", ..., "dek nau" - a "dek" followed by a single space and the number for the last digit. Numbers 20 through 29 are spelled: "dudek", "dudek unu", "dudek du", ..., "dudek nau". Similarly, 30 is "tridek", ..., 90 is "naudek" - we just join together the number of tens and "dek". There are no exceptions like "twelve" or "thirty" in English.

Given an int x between 1 and 99, inclusive, return its Esperanto spelling.

Definition

Class:
EsperantoNumbers
Method:
nameThisNumber
Parameters:
int
Returns:
String
Method signature:
String nameThisNumber(int x)
(be sure your method is public)

Constraints

  • x will be between 1 and 99, inclusive.

Examples

  1. 1
    Returns: "unu"
  2. 90
    Returns: "naudek"
  3. 11
    Returns: "dek unu"
  4. 57
    Returns: "kvindek sep"
Back to all problems