TORONTO KIDS COMPUTER CLUB | Aurora Saturday 14:30 Python Practice 22.11.26.
21470
post-template-default,single,single-post,postid-21470,single-format-standard,ajax_fade,page_not_loaded,,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.10.0,vc_responsive

Aurora Saturday 14:30 Python Practice 22.11.26.

29 Nov Aurora Saturday 14:30 Python Practice 22.11.26.

Question: 

The Fibonacci (Fibonacci numbers) is defined as:
F (1) = 1;
F (2) = 2;
F (n) = f (n-1) + f (n-2) (n>=3);
So, 1,2,3,5,8,13 … is the Fibonacci series.

There is a game, defined as follows:
1, this is a two players game;
2, a total of 3 piles of stones, the number is m, n, p;
3, two player will take turn;
4, each step can choose any pile of stones, and then take away f number of stones from that pile;
5, f can only be the element in the Fibonacci sequence (that is, each time only take 1,2,3,5,8 …);
6, the player who take the last stone wins;

Assuming both player use the best strategy, judge whether the first player will win or the second player will win.

Input
The input data contains multiple test cases, one row for each test case, and 3 integer m,n,p (1<=m,n,p<=1000).
M=n=p=0 indicates the end of the input.

Output
If the first player wins, output “Fibo”, otherwise output “Nacci”, the output of each test case takes one row.

Sample Input
1 1 1
1 4 1
0 0 0

Sample Output
Fibo
Nacci

No Comments

Sorry, the comment form is closed at this time.