#P8629. [蓝桥杯 2015 国 C] 机器人繁殖
[蓝桥杯 2015 国 C] 机器人繁殖
Description
Robots in the X galaxy can copy themselves automatically. In year, each robot can reproduce copies of itself, and then it loses the ability to reproduce.
Every year, the X galaxy will select newly born robot and send it into space. That is, if the X galaxy originally has robots, then:
After year, the total number is: .
After years, the total number is: .
If you have already observed that after years the total number of robots is , can you calculate how many robots there were at the beginning?
Input Format
Input one line with two numbers and , separated by spaces, with the meanings as described above. is not greater than , and has at most digits.
Output Format
Output one line with one integer, indicating how many robots there were at the beginning.
2 31
5
97 2218388550399401452619230609499
8
Hint
Time limit: second, . Lanqiao Cup 2015, 6th National Finals.
Translated by ChatGPT 5
京公网安备 11011102002149号