Baekjoon #2018

Baekjoon #2018

1개의 풀이 · Python

문제 원문 보기 ↗

SOLUTION INFO

Python · main.py

main.py
import sys

def input():
    return sys.stdin.readline().rstrip()

N = int(input())
arr = [i for i in range(1, N+1)]
s, e = 0, 0
ans = 0
total = 0
while True:
    if total < N:
        total += arr[e]
        e += 1
    elif e == len(arr):
        break
    elif total >= N:
        if total == N:
            ans += 1
        total -= arr[s]
        s += 1
print(ans+1)

SOLUTION DESCRIPTION

풀이 설명

등록된 풀이 설명이 없습니다.