Published:
Updated:


Solution

import sys


def solution(A: int, B: int) -> int:
    answer = []

    for i in range(1, B + 1):
        for _ in range(i):
            answer.append(i)

    return sum(answer[A - 1:B])


def main() -> None:
    A, B = map(int, sys.stdin.readline().rstrip().split())
    print(solution(A, B))


if __name__ == '__main__':
    main()

Leave a comment