반응형

-풀이

s = int(input())
n = 1
while n*(n+1)/2<=s:
    n += 1
print(n - 1)

-풀이설명

1. 1~n까지 수들의 합의 공식을 알아야한다. n*(n+1)/2

2.1부터 차례대로 더해 s보다 커지면 n-1을 출력하면 된다.

풀이출처 : https://pacific-ocean.tistory.com/80

+ Recent posts