-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathluba.py
More file actions
43 lines (38 loc) · 808 Bytes
/
luba.py
File metadata and controls
43 lines (38 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
l=list(input())
for i in range(len(l)):
l[i]=int(l[i])
sum1=l[0]+l[1]+l[2]
sum2=l[3]+l[4]+l[5]
if sum1==sum2:
print(0)
if(sum1<sum2):
t=sum1
sum1=sum2
sum2=t
l=l[::-1]
if(sum1>sum2):
dif=sum1-sum2
l1=[l[0],l[1],l[2]]
l2=[l[3],l[4],l[5]]
c=0;
wen=0
if(abs(dif-sum1)<abs(dif-sum2)):
wen=2
else:
wen=1
if wen==1:
while(dif>0):
c=c+1
if(max(l1)-dif>0):
print(c)
dif=0
else:
dif=dif-max(l1)
if wen==2:
while(dif>0):
c=c+1
if(dif-9+min(l2)<0):
print(c)
dif=0
else:
dif=dif-9+min(l2)