1부터 n까지의 합이 s보다 작거나 같은 경우의 n을 도출
1 = 1 -> 1개
1+2 = 3 -> 2개
1+2+3 = 6 -> 3개
1+2+3+4 = 10 -> 4개
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | ... |
---|---|---|---|---|---|---|---|---|---|---|
1 | 1 | 2 | 2 | 2 | 3 | 3 | 3 | 3 | 4 | ... |
s = int(input())
n = 1
while True:
if n*(n+1)/2 <= s < (n+1)*(n+2)/2:
break
n += 1
print(n)