def fun176(x):
x =
str_x = ','.join(x)
sum_list,result_list = [],[]
for i in range(1,len(str_x)):
if str_x == '-':
continue
x_1 = .split(',') if i != '']]
x_2 = .split(',') if i != '']]
result_list.append()
sum_list.append(abs(sum(x_1)-sum(x_2)))
return result_list
if __name__ == '__main__':
print(fun176()) def slice(number):
if number=='':
return 0
else:
return eval(number)
def separate(L):
list1=[]
for i in range(len(L)):
m=L
l=len(str(m))
if m>=0:
for j in range(0,l+1):
list1.append((i,j,abs(sum(L[:i])+slice(str(m)[:j])-slice(str(m))-sum(L))))
else:
for j in range(2,l+1):
list1.append((i,j,abs(sum(L[:i])+slice(str(m)[:j])-slice(str(m))-sum(L))))
w,v=sorted(list1,key=lambda number:number)[:2]
if v==0:
return L[:w],L
elif v==len(str(L)):
return L[:w+1],L
else:
return L[:w]+)[:v])],))]+L
print(separate())
大佬啥情况,这每日一题好久没更了,手都生了{:10_257:} arr =
n = len(arr)
Sum_arr = sum(arr)
ans, idx = float('inf'), 0
a = arr
for i in range(1, n - 1):
a += arr
b = abs(Sum_arr - a * 2)
if b < ans:
ans, idx = b, i
print(arr[:idx + 1], arr)
页:
1
[2]