/
実行時間制限: 2 sec / メモリ制限: 1024 MiB
配点 : 200 点
問題文
年に 1 度の節分には年齢と同じ数の豆を食べます。高橋君はそれ以外に豆を食べることはありません。
高橋君は、今年 ( 0 年後 ) の節分の時点で N 歳です。
高橋君が今年以降 (今年を含む) で累計 K 個以上の豆を食べたことになるのは、最短で何年後の節分ですか?
なお、高橋君は不死身なので、高橋君が今年以降で累計 K 個以上の豆を食べたという状況は必ず訪れます。
制約
- 入力は全て整数
- 1 \le N,K \le 10^8
入力
入力は以下の形式で標準入力から与えられる。
N K
出力
答えを出力せよ。
入力例 1
4 43
出力例 1
6
- 0 年後の節分に高橋君は 4 個の豆を食べ、今年以降で累計で 4 個の豆を食べます。
- 1 年後の節分に高橋君は 5 個の豆を食べ、今年以降で累計で 9 個の豆を食べます。
- 2 年後の節分に高橋君は 6 個の豆を食べ、今年以降で累計で 15 個の豆を食べます。
- 3 年後の節分に高橋君は 7 個の豆を食べ、今年以降で累計で 22 個の豆を食べます。
- 4 年後の節分に高橋君は 8 個の豆を食べ、今年以降で累計で 30 個の豆を食べます。
- 5 年後の節分に高橋君は 9 個の豆を食べ、今年以降で累計で 39 個の豆を食べます。
- 6 年後の節分に高橋君は 10 個の豆を食べ、今年以降で累計で 49 個の豆を食べます。
6 年後の節分の時点で累計 43 個以上の豆を食べたことになるので、 6 と出力してください。
入力例 2
100000000 100000000
出力例 2
0
今年のみで食べた豆の個数が K 個以上に達することもあります。
入力例 3
1234 12345678
出力例 3
3886
Score : 200 points
Problem Statement
At the annual Setsubun festival, one eats the same number of beans as their age. Takahashi-kun does not eat beans at any other time.
He is N years old at this year's Setsubun (0 years later).
At the earliest, how many years later will he have eaten a total of K or more beans from this year onward (including this year)?
He is immortal, so he will eventually have eaten a total of K or more beans from this year onward.
Constraints
- All input values are integers.
- 1 \le N,K \le 10^8
Input
The input is given from Standard Input in the following format:
N K
Output
Print the answer.
Sample Input 1
4 43
Sample Output 1
6
- At Setsubun 0 years later, Takahashi-kun eats 4 beans, totaling 4 beans from this year onward.
- At Setsubun 1 year later, he eats 5 beans, totaling 9 beans from this year onward.
- At Setsubun 2 years later, he eats 6 beans, totaling 15 beans from this year onward.
- At Setsubun 3 years later, he eats 7 beans, totaling 22 beans from this year onward.
- At Setsubun 4 years later, he eats 8 beans, totaling 30 beans from this year onward.
- At Setsubun 5 years later, he eats 9 beans, totaling 39 beans from this year onward.
- At Setsubun 6 years later, he eats 10 beans, totaling 49 beans from this year onward.
At Setsubun 6 years later, he will have eaten a total of 43 or more beans, so output 6.
Sample Input 2
100000000 100000000
Sample Output 2
0
The number of beans eaten this year alone may reach K or more.
Sample Input 3
1234 12345678
Sample Output 3
3886