# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
161450 |
2019-11-02T15:23:41 Z |
boolodifjenula |
Lun (COCI19_lun) |
Python 3 |
|
44 ms |
3432 KB |
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
if z%10<T:
x=10-T-z%10
elif z%10==T:
x=0
else:
x=10-(T-z%10)
if N%2==0 and m%2==0 or N%2==1 and m%2==1:
x//=2
print(x)
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
3328 KB |
Output is correct |
2 |
Correct |
26 ms |
3432 KB |
Output is correct |
3 |
Correct |
26 ms |
3428 KB |
Output is correct |
4 |
Correct |
26 ms |
3328 KB |
Output is correct |
5 |
Correct |
26 ms |
3320 KB |
Output is correct |
6 |
Incorrect |
25 ms |
3428 KB |
Output isn't correct |
7 |
Incorrect |
25 ms |
3432 KB |
Output isn't correct |
8 |
Correct |
26 ms |
3428 KB |
Output is correct |
9 |
Incorrect |
26 ms |
3328 KB |
Output isn't correct |
10 |
Incorrect |
44 ms |
3360 KB |
Output isn't correct |