文章

10

粉丝

253

获赞

8

访问

29.6k

头像
python,通过50%
P1722 北京理工大学2017年机试题
发布于2023年1月11日 17:25
阅读数 2.9k

 

a = "7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4 2"
quan = list(map(int,a.split()))
a = "1 0 X 9 8 7 6 5 4 3 2"
y = list(map(str,a.split()))
while True:
    try:
        sf = input()
        x = [int(sf[i]) for i in range(len(sf)-1)]
        x.append(sf[17])
        if len(x)!=18:
            print("ID Wrong")
        else:
            he = 0
            for i in range(17):
                he = he+x[i]*quan[i]
                
            
            he = he%11
            if y[he]==x[17]:
                print("ID Corrent")
            else:
                print("ID Wrong")
    except:
        
        break

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发