2894. Divisible and Non-divisible Sums Difference

Обновлено: 2024-03-12
1 мин
[]

Содержание

LeetCode problem 2894

class Solution:
    def differenceOfSums(self, n: int, m: int) -> int:
        return sum(i if i % m else -i for i in range(1, n + 1))