#abc263b. B - Ancestor
B - Ancestor
Score : points
问题描述
设有 个人,分别称为 Person 1、Person 2、、Person 。
其中,Person 的父母是 Person 。这里保证 。
请问 Person 1 距离 Person 有多少代?
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
There are people, called Person , Person , , Person .
The parent of Person is Person . Here, it is guaranteed that .
How many generations away from Person is Person ?
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer as a positive integer.
Sample Input 1
3
1 2
Sample Output 1
2
Person is a parent of Person , and thus is one generation away from Person .
Person is a parent of Person , and thus is two generations away from Person .
Therefore, the answer is .
Sample Input 2
10
1 2 3 4 5 6 7 8 9
Sample Output 2
9
update @ 2024/3/10 11:07:20