304900: CF931B. World Cup

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

World Cup

题意翻译

## 题目描述 世界杯足球赛的最后一个阶段是使用决赛系统进行的。 这个阶段还有n个团队,从1到n枚举。举行了几轮比赛,每轮比赛中,剩下的队伍按照ID的顺序进行排序,然后按此顺序的第一个队与第二个队比赛,第三个队与第四个队比赛,第五个队与第六个队比赛,依此类推。保证每轮比赛都有偶数支球队。每场比赛的胜利者晋级下一轮,失败者被淘汰出局,没有平局。在最后一轮比赛中,只有剩下的两支球队参加:这轮比赛称为决赛,获胜者称为冠军,比赛结束。 Arkady想让他最喜欢的两支球队参加决赛。不幸的是,团队ID已经确定了,而且可能会发生这样的情况:如果团队足够强大的话,他们就不可能在决赛中相遇,因为他们将在更早的阶段相遇。确定ID A和B的团队可以在哪一轮会面。 ## 输入输出格式 ### 输入格式: 一行包含三个整数n,a和b(2<=n<=256,2<=n<=256,1<=a,b<=n,1<=a,b<=n)团队总数和Arkady感兴趣的团队的ID。 可以保证n是这样的:在每轮比赛中,队伍前进的次数是偶数,a和b不相等。 ### 输出格式: 在唯一一行输出“Final!”,如果A队和B队能在决赛中相遇。 否则,输出一个整数,a队和b队可以相遇的轮数。该轮从1开始计算。 说明 在第一个例子中,1队和2队在第一轮比赛中相遇。 在第二个例子中,2队和6队只能在第三轮比赛中相遇,这是决赛,前提是他们在前几轮中赢得了所有的对手。 在第三个例子中,如果在第一轮中赢得对手,IDS7和55的球队可以在第二轮中相遇。

题目描述

The last stage of Football World Cup is played using the play-off system. There are $ n $ teams left in this stage, they are enumerated from $ 1 $ to $ n $ . Several rounds are held, in each round the remaining teams are sorted in the order of their ids, then the first in this order plays with the second, the third — with the fourth, the fifth — with the sixth, and so on. It is guaranteed that in each round there is even number of teams. The winner of each game advances to the next round, the loser is eliminated from the tournament, there are no draws. In the last round there is the only game with two remaining teams: the round is called the Final, the winner is called the champion, and the tournament is over. Arkady wants his two favorite teams to play in the Final. Unfortunately, the team ids are already determined, and it may happen that it is impossible for teams to meet in the Final, because they are to meet in some earlier stage, if they are strong enough. Determine, in which round the teams with ids $ a $ and $ b $ can meet.

输入输出格式

输入格式


The only line contains three integers $ n $ , $ a $ and $ b $ ( $ 2<=n<=256 $ , $ 1<=a,b<=n $ ) — the total number of teams, and the ids of the teams that Arkady is interested in. It is guaranteed that $ n $ is such that in each round an even number of team advance, and that $ a $ and $ b $ are not equal.

输出格式


In the only line print "Final!" (without quotes), if teams $ a $ and $ b $ can meet in the Final. Otherwise, print a single integer — the number of the round in which teams $ a $ and $ b $ can meet. The round are enumerated from $ 1 $ .

输入输出样例

输入样例 #1

4 1 2

输出样例 #1

1

输入样例 #2

8 2 6

输出样例 #2

Final!

输入样例 #3

8 7 5

输出样例 #3

2

说明

In the first example teams $ 1 $ and $ 2 $ meet in the first round. In the second example teams $ 2 $ and $ 6 $ can only meet in the third round, which is the Final, if they win all their opponents in earlier rounds. In the third example the teams with ids $ 7 $ and $ 5 $ can meet in the second round, if they win their opponents in the first round.

Input

题意翻译

## 题目描述 世界杯足球赛的最后一个阶段是使用决赛系统进行的。 这个阶段还有n个团队,从1到n枚举。举行了几轮比赛,每轮比赛中,剩下的队伍按照ID的顺序进行排序,然后按此顺序的第一个队与第二个队比赛,第三个队与第四个队比赛,第五个队与第六个队比赛,依此类推。保证每轮比赛都有偶数支球队。每场比赛的胜利者晋级下一轮,失败者被淘汰出局,没有平局。在最后一轮比赛中,只有剩下的两支球队参加:这轮比赛称为决赛,获胜者称为冠军,比赛结束。 Arkady想让他最喜欢的两支球队参加决赛。不幸的是,团队ID已经确定了,而且可能会发生这样的情况:如果团队足够强大的话,他们就不可能在决赛中相遇,因为他们将在更早的阶段相遇。确定ID A和B的团队可以在哪一轮会面。 ## 输入输出格式 ### 输入格式: 一行包含三个整数n,a和b(2<=n<=256,2<=n<=256,1<=a,b<=n,1<=a,b<=n)团队总数和Arkady感兴趣的团队的ID。 可以保证n是这样的:在每轮比赛中,队伍前进的次数是偶数,a和b不相等。 ### 输出格式: 在唯一一行输出“Final!”,如果A队和B队能在决赛中相遇。 否则,输出一个整数,a队和b队可以相遇的轮数。该轮从1开始计算。 说明 在第一个例子中,1队和2队在第一轮比赛中相遇。 在第二个例子中,2队和6队只能在第三轮比赛中相遇,这是决赛,前提是他们在前几轮中赢得了所有的对手。 在第三个例子中,如果在第一轮中赢得对手,IDS7和55的球队可以在第二轮中相遇。

加入题单

上一题 下一题 算法标签: