Pirates and coins
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
n
pirates fairly divided the treasure of m
gold coins - everyone got his part according to their rank and seniority pirate. Youngest pirate took a
coin and each pirate taking on the next one coin more than the previous colleague. The last was the captain, who got twice as much of the plan, it is obvious that after the coins are no more.
How many pirates along with the captain, if we know a
and m
. Since the captain without a team just a pirate, then n > 1
.
Input
Two positive integers a
and m
(1 ≤ a ≤ 100
, m < 15150
). Input values are correct.
Output
The number of pirates n
.
Examples
Input #1
Answer #1
Submissions 17K
Acceptance rate 53%