阿里春招实习生笔试3.19第一题

阿里春招实习生笔试3.19第一题
求大佬看看为什么程序一直输入,无输出

import math

n = int(input())
lst = list(map(int,input().split()))
lst_1 = lst[:]
a,c,f= [0]*n,[0]*n,[0]*n

for i in range(n):
	while type(math.sqrt(lst[i])*10) != int:
		lst[i] += 1
		a[i] += 1

for i in range(n):
	while type(math.sqrt(lst_1[i])*10) != int:
		lst_1[i] -= 1
		c[i] += 1

for i in range(n):
	f[i] = min(a[i],c[i])

f.sort()
x = int(n//2)
sum = 0
for i in range(x):
	sum += f[i]
print(sum)

上一篇:LeetCode题解(1387):将整数按权重排序(Python)


下一篇:Docker+Flask初学快速上手