#1836: a002answer but give me 9999999999999999999999999 USD


1753422-4@g.puiching.edu.mo (P5A30廖善衡)

School : No School
ID : 2950
IP address : [192.168.120.33]
Last Login :
2025-03-20 11:41:41
a002. 電話客服中心 -- 板橋高中教學題 | From: [192.168.120.33] | Post Date : 2025-03-18 14:18

 

letter_to_code = {

    'A': 10, 'B': 11, 'C': 12, 'D': 13, 'E': 14,

    'F': 15, 'G': 16, 'H': 17, 'I': 34, 'J': 18,

    'K': 19, 'L': 20, 'M': 21, 'N': 22, 'O': 35,

    'P': 23, 'Q': 24, 'R': 25, 'S': 26, 'T': 27,

    'U': 28, 'V': 29, 'W': 32, 'X': 30, 'Y': 31,

    'Z': 33

}

 

 

weights = [1, 9, 8, 7, 6, 5, 4, 3, 2, 1]

 

def calculate_check_code(full_id):

    

    total = 0

    for i in range(10):

        total += int(full_id[i]) * weights[i]

    

    check_code = (10 - (total % 10)) % 10

    return check_code

 

def find_possible_letters(last_nine_digits):

    possible_letters = []

    

    for letter, code in letter_to_code.items():

        

        full_id = str(code) + last_nine_digits[:8]

        

        check_code = calculate_check_code(full_id)

        

        if check_code == int(last_nine_digits[8]):

            possible_letters.append(letter)

   

    possible_letters.sort()

    return ''.join(possible_letters)

 

 

inputs = []

while True:

    try:

        line = input().strip()

        if line:

            inputs.append(line)

        else:

            break

    except EOFError:

        break

for line in inputs:

    print(find_possible_letters(line))

 
ZeroJudge Forum