<PREV Problem:
NEXT>
Solved by 387 users: ...
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 

Stone Game II -- who is the winner?

Time limit = 5 seconds

You are to determine the status of a position in Another Stone Game, that has the following rules.

There are k stone piles with n1, n2, ... , nk stones. One is permitted to take any positive number of stones from one pile for a move, but no more than half of the pile.

The one who can't make his move loses.

Input contains the number of piles and their sizes. k < 50, ni < 100 000.

Output either the string "First wins." or the string "Second wins." (without quotes).

Input#1
3
3 2 1
Output#1
First wins. 
Input#2
4
1 3 7 63
Output#2
Second wins.

Author:
Well-known problem. Added by Voroztsov Artem.

<PREV | Problem set | Search related messages | NEXT>


© acm.mipt DevGroup
The page was generated in 180ms

SW soft NIX
ID = 54.144.21.195