得不出正确结果的代码---牛牛爱水题

def yinzi(m):
s=[]
for i in range(1,int(math.sqrt(m))+1):
if m%i==0:
s.append(i)
if i!=m/i:
s.append(m/i)
return s
import math
class Solution:
def doQuestion(self , n ):
# write code here
happy=0
for j in range(1,n+1):
k=yinzi(j)
if sum(k)/n<2:
happy=happy+j
else:
pass
return happy

全部评论
if sum(k)/n<2:------------->if sum(k)/j<2:
点赞 回复
分享
发布于 2021-04-07 23:04

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务