可以看看为啥通过0不呢: def cal(x): if x == 1: return 0 temp = x i = 2 divisors = [] while True: if i > x//i: break while temp % i == 0: divisors.append(i) temp = temp // i i += 1 if temp > 1: divisors.append(temp) return sum(divisors)-1 n = int(input()) a = [int(x) for x in input().split()] a = [cal(x) for x in a] print(sum(a))
点赞 1

相关推荐

02-25 13:02
中南大学 C++
点赞 评论 收藏
分享
03-02 08:18
集美大学 Java
钱嘛数字而已:没有赛事奖项么?另外,项目经历字有点多哈,建议突出一下重点:用的什么技术,解决什么问题,达到什么效果。
大家都开始春招面试了吗
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务