Game of Factors
All submissions for this problem are available.
Appu and her friend want to play a game - Game of Factors. Initially, they have a group of n positive integers. In a move, a player can take one of the integers Ai from the array and convert it into two integers x and y such that x*y = Ai (Here x or y cannot be 1). Notice that after a successful move, the size of the array increases by 1.
The player who cannot make a successful move loses.
However, Appu and her friend are busy chatting in Times' Square. You are given the array of n positive integers. Help Appu determine who wins the game, if Appu insists on always starting the game.
The input consists of several test cases.
- The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
- The first line of each test case contains n denoting the initial number of positive integers in the array.
- The second line contains n space-separated integers A1, A2, ..., AN denoting the initial integers in the array .
For each test case, output a single line containing "Appu" or "Friend" without quotes depending on who the winner of the game is.
- 1 ≤ T ≤ 50
- 1 ≤ n ≤ 106
- 1 ≤ A[i] ≤ 106
Appu will start the game and the only option for her is to change 4 to 2 and 2. Now, no more moves exist for her friend. Hence, Appu wins the game.
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, kotlin, PERL6, TEXT, SCM chicken, CLOJ, COB, FS|
Fetching successful submissions