Human Pyramid

시간 제한1초메모리 제한1024 MB

요약
사람 수 n이 주어질 때 1+2+...+h가 n을 넘지 않는 가장 큰 높이 h를 구한다.
난이도

쉬움10점 중 3점

유형
이분 탐색, 수학
정답자
아직 제출이 없습니다

문제

As chairman of the Building A Pyramid Committee, you are specialized in breaking one specific world record: building the highest human pyramid. Unfortunately, you only know a limited number of people who are willing to be in the pyramid. After all, building human pyramids does not make much money, so most people are volunteers.

A full human pyramid of height \(h\) consists of \(h\) layers of people. As seen from below, it has \(h\) people on the first layer, \(h-1\) on the second, \(h-2\) on the third, and so forth until eventually the final layer has just a single person. To determine whether you can break the world record, you need to know how high a pyramid you can build. Given how many people are available, how tall is the highest possible human pyramid that these people can make?

입력

The input consists of:

  • One line with an integer nn (1≤n≤10121 \leq n \leq 10^{12}), the number of people available to build the pyramid.

출력

Output the height of the highest possible pyramid you can build with nn people.

예제2

  1. 예제 1

    입력
    3
    
    예상 출력
    2
    
  2. 예제 2

    입력
    12
    
    예상 출력
    4