Submission #100423

# Submission time Handle Problem Language Result Execution time Memory
100423 2019-03-11T06:37:29 Z tnbs10 Lun (COCI19_lun) Python 3
50 / 50
34 ms 3428 KB
n = int(input())
s = list(input())
for i in range(n):
    if s[i].isdigit():
        s[i] = int(s[i])
s.reverse()
x = s.index("x")
for i in range(10):
    a = s[:]
    a[x] = i
    zbroj = 0
    for j in range(1, n):
        if j % 2:
            a[j] = a[j] * 2
            if a[j] >= 10:
                a[j] = a[j] % 10 + a[j] // 10
        zbroj += a[j]
    if (zbroj * 9) % 10 == a[0]:
        print(i)
        break
# Verdict Execution time Memory Grader output
1 Correct 26 ms 3300 KB Output is correct
2 Correct 23 ms 3308 KB Output is correct
3 Correct 24 ms 3308 KB Output is correct
4 Correct 25 ms 3308 KB Output is correct
5 Correct 24 ms 3308 KB Output is correct
6 Correct 28 ms 3300 KB Output is correct
7 Correct 34 ms 3428 KB Output is correct
8 Correct 25 ms 3308 KB Output is correct
9 Correct 22 ms 3308 KB Output is correct
10 Correct 23 ms 3300 KB Output is correct