<PREV Problem:
NEXT>
Solved by 388 users: ...
UserDateAttemptTimeCMSC
crazyb0y11 feb 2008C++200.0143 
crazyb0y13 feb 2008C++300.0143 
crazyb0y22 jan 2008C++100.0144 
zhuojie13 feb 2008Python100.0644 
vi00217 jul 2007Ruby1700.0245 
daniel.ugra06 jan 2007Ruby300.0246 
daniel.ugra06 jan 2007Ruby200.0249 
Senya01 may 2010C++1300.0153 
MasterYoda04 apr 2009C++1000.0154 
Qsky08 nov 2006FPC200.0155 
NDAT08 nov 2006FPC200.0155 
Skyslars08 nov 2006FPC1000.0155 
Skyslars08 nov 2006FPC1100.0155 
nt_d208 nov 2006FPC2800.0155 
Languages
C++
216
FPC
105
C
31
Kylix
17
Java
16
Ruby
5
Python
3
Lua
1
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 

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 200ms

SW soft NIX
ID = 35.172.233.215