m1ndy5's coding blog

[수학] 백준 8393번 합 with Python 본문

알고리즘 with python/수학

[수학] 백준 8393번 합 with Python

정민됴 2023. 2. 26. 23:21

https://www.acmicpc.net/problem/8393

n = int(input())
s = 0
for i in range(1, n+1):
    s += i
print(s)

이 문제의 포인트는 sum 변수를 0으로 초기화 해주고 for문의 range를 1부터 n까지 설정해주는 것이었다!