# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
161857 | boolodifjenula | Lun (COCI19_lun) | Cpython 3 | 1085 ms | 3428 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=input()
T=S[N-1]
z=0
if T=="x":
for i in range(N-2,-1,-1):
if N%2==0 and i%2==0 or N%2==1 and i%2==1:
z+=(2*int(S[i]))%10+(2*int(S[i]))//10
else:
z+=int(S[i])
print(z*9%10)
else:
m=0
T=int(T)
x=0
for i in range(N-2,-1,-1):
if S[i]!="x" and (N%2==0 and i%2==0 or N%2==1 and i%2==1):
z+=(2*int(S[i]))%10+(2*int(S[i]))//10
elif S[i]!="x":
z+=int(S[i])
if S[i]=="x":
m=i
while 1:
if N%2==0 and m%2==0 or N%2==1 and m%2==1:
if (z+(2*x)%10+(2*x)//10)*9%10==T:
print(x)
break
else:
if (z+x)*9%10==T:
print(x)
break
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |