12835 - GEC1506 - Advanced -TW ID number Decoding   

Description

We have introduced the encoding and decoding.

In this problem, you need to process the numerical format of the TW ID number and return the register location of the person.

 

Assuming that there is an ID number as M140051653, the alphabet in the ID number is the registered city/county and the rest numbers are used to verify the ID number.

To make sure the ID number is a verified ID, we need to follow the rules:

  1. Convert the alphabet M to numerical form as 21. (We will provide the mapping table below)
  2. Present all the digits of the ID number (M140051653) as a numerical form (21140051653).
  3. For each digit, we multiply with a given number as:
    n_{1}\times 1+n_{2}\times 9+n_{3}\times 8+n_{4}\times 7+n_{5}\times 6+n_{6}\times 5+n_{7}\times 4+n_{8}\times 3+n_{9}\times 2+n_{{10}}\times 1+n_{{11}}\times 1
  4. Sum all the multiplied result.
  5. As a qualified ID number, the remainder of the sum result divided by 10 should be 0.
  6.  Hint: You can use isdigit() to verify if the input character is digit or not 

Input

The first several lines are the required mapping table for the alphabet and its number, such as:

K,19,MiaoliCountry
M,21,NantouCounty
N,22,ChanghuaCounty
O,35,HsinchuCity

The last line is the ID number that is missing the alphabet which is shown as:

140051653

 

Note that the candidate will not be the same for different test cases.

Output

You need to provide the possible registering city/county for the id number.

 

To find the possible registering city/county, you need to go over all the possible candidates to verify them.

Sample Input  Download

Sample Output  Download

Tags




Discuss