Demo entry 6647768

S

   

Submitted by anonymous on Oct 21, 2017 at 12:22
Language: Python 3. Code size: 682 Bytes.

N = int(input()) #カード数
stat = []
for i in range(N):
    a = input()
    stat.append(a)
for element in stat:
    splited = [] #divide the id from str to individual number
    for i in range(15):
        su = element[i]
        su = int(su)
        splited.append(su)
    even = 0
    for i in range(0,15,2): #even
        two = splited[i] * 2
        if(two >= 10):
            k10 = two // 10
            k1 = two % 10
            two = k10 + k1
        even = even + two
    odd = 0
    for i in range(1,14,2): #odd
        odd = odd + splited[i]
    number = even + odd
    num = number % 10
    X = 10 - num
    if (X == 10):
        X = 0
    print(X)

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).