P8629 [Lанqiao Cup 2015 National C] Robot Reproduction
Description
Robots in the X galaxy can copy themselves automatically. In $1$ year, each robot can reproduce $2$ copies of itself, and then it loses the ability to reproduce.
Every year, the X galaxy will select $1$ newly born robot and send it into space. That is, if the X galaxy originally has $5$ robots, then:
After $1$ year, the total number is: $5 + 9 = 14$.
After $2$ years, the total number is: $5 + 9 + 17 = 31$.
If you have already observed that after $n$ years the total number of robots is $s$, can you calculate how many robots there were at the beginning?
Input Format
Input one line with two numbers $n$ and $s$, separated by spaces, with the meanings as described above. $n$ is not greater than $100$, and $s$ has at most $50$ digits.
Output Format
Output one line with one integer, indicating how many robots there were at the beginning.
Explanation/Hint
Time limit: $1$ second, $512\text{M}$. Lanqiao Cup 2015, 6th National Finals.
Translated by ChatGPT 5