B - Savings Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MB

配点 : 200200

問題文

シカのAtCoDeerくんは、空の貯金箱を持っています。
AtCoDeerくんは、その貯金箱に、11 日目の朝に 11 円、22 日目の朝に 22\dots というように、ii 日目の朝に ii 円を貯金箱に入れます。
また、AtCoDeerくんは、毎日夜に貯金箱にいくら入っているかを確認します。
AtCoDeerくんが貯金箱に NN 円以上入っていることを初めて確認するのは、何日目の夜でしょうか?

制約

  • 1N1091 \le N \le 10^9
  • NN は整数

入力

入力は以下の形式で標準入力から与えられる。

NN

出力

答えを整数として出力せよ。


入力例 1Copy

Copy
12

出力例 1Copy

Copy
5
  • 11 日目の朝に 11 円貯金する。 この日の夜、貯金箱の中身は 11 円である。
  • 22 日目の朝に 22 円貯金する。 この日の夜、貯金箱の中身は 33 円である。
  • 33 日目の朝に 33 円貯金する。 この日の夜、貯金箱の中身は 66 円である。
  • 44 日目の朝に 44 円貯金する。 この日の夜、貯金箱の中身は 1010 円である。
  • 55 日目の朝に 55 円貯金する。 この日の夜、貯金箱の中身は 1515 円である。

よって、AtCoDeerくんが貯金箱に 1212 円以上入っていることを初めて確認するのは、 55 日目の夜です。


入力例 2Copy

Copy
100128

出力例 2Copy

Copy
447

Score : 200200 points

Problem Statement

AtCoDeer has an empty piggy bank.
On the morning of the ii-th day, he will put ii yen (Japanese currency) in it: 11 yen on the morning of the 11-st day, 22 yen on the morning of the 22-nd day, and so on.
Each night, he will check the amount of money in it.
On which day will he find out that his piggy bank has NN yen or more for the first time?

Constraints

  • 1N1091 \le N \le 10^9
  • NN is an integer.

Input

Input is given from Standard Input in the following format:

NN

Output

Print an integer xx such that AtCoDeer will find out that his piggy bank has NN yen or more for the first time on the xx-th day.


Sample Input 1Copy

Copy
12

Sample Output 1Copy

Copy
5
  • On the 11-st day, the piggy bank gets 11 yen in the morning and has 11 yen at night.
  • On the 22-st day, the piggy bank gets 22 yen in the morning and has 33 yen at night.
  • On the 33-rd day, the piggy bank gets 33 yen in the morning and has 66 yen at night.
  • On the 44-th day, the piggy bank gets 44 yen in the morning and has 1010 yen at night.
  • On the 55-th day, the piggy bank gets 55 yen in the morning and has 1515 yen at night.

Thus, on the 55-th night, AtCoDeer will find out that his piggy bank has 1212 yen or more for the first time.


Sample Input 2Copy

Copy
100128

Sample Output 2Copy

Copy
447


2025-04-22 (Tue)
06:24:32 +00:00