Skip to content

Latest commit

 

History

History
43 lines (29 loc) · 1.13 KB

File metadata and controls

43 lines (29 loc) · 1.13 KB

Converter

(Translated with Google Translate)

Your task is to write a converter that will convert the number L in the positional number system on the base n to the positional number system on the base m. Additionally, you need to verify that the converted number is correct. Return NaN if the number cannot exist on the specified system. The input is case insensitive as long as one style is kept.

Entry:

three lines of text, containing in turn:
    n - the base of the converted number (natural number, 1 <n <36)
    L - converted number, written at base n (integer, 0 <= L <232)
    m - the base of the number after conversion (integer, 1 <m <36)

Exit:

one line of text containing the calculated form of the number (capital letters only) or the following text:

NaN

if the conversion is not feasible, including due to the incorrectness of any of the data.

Example:

Entry:

16 aaF 19

Exit: NaN

Entry: 16 FF 2

Exit: 11111111

Additional information

  • the program will be run 10 times for different datasets
  • each correct solution gives 10% of the task score
  • the task has a point value of 2.0