Start: Jul, 06, 2019 10:00:00
20190706Python程序设计基础培训扩展练习
End: Jul, 17, 2019 12:00:00
Time elapsed:
Time remaining:

Problem_ID: H
Result: Accepted
Time: 46ms
Memory: 25312kB
Author: 13336131920
In contest: 1300

while True:
    try:
        b = input()#格式固定 按索引下标取出来进行相应运算
        total = int(b[0])+int(b[2])*2+int(b[3])*3+int(b[4])*4+int(b[6])*5+int(b[7])*6+int(b[8])*7+int(b[9])*8+int(b[10])*9
        total%=11
        if b[-1] == "X":#原末尾是x
            if total == 10:#若余数是10 则正确
                print("Right")
            else:#否则替换成正确的余数
                print(b[:-1]+str(total))
        else:
            if b[-1] == str(total):#若余数刚好是正确的
                print("Right")
            else:
                if total == 10:#若不正确 并且是10
                    print(b[:-1]+"X")#替换成x
                else:
                    print(b[:-1]+str(total))#既不正确,又不是10则替换成正确的余数

    except EOFError:
        break