# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
100287 | tnbs10 | Lun (COCI19_lun) | Cpython 3 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
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