1. leetcode每日一题
今天这个就很简单,遍历、取余,没什么可说的。
class Solution:
def sumOfMultiples(self, n: int) -> int:
n_sum = 0
for num in range(1,n+1):
if (num % 3==0) or (num % 5 == 0) or (num % 7 == 0):
n_sum += num
return n_sum