题目链接
思路:
简单的博弈论,如果全是1那就看奇偶,如果开头有1那就看最后谁能先拿到不为1谁就赢,因为他能控制下一个人。
代码:
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const int N=1e5+7;
const double eps=1e-8;
const int mod=1e9+7;
const int inf=0x7fffffff;
const double pi=3.1415926535;
signed main()
{
int t;
cin>>t;
while(t--)
{
int n,a,sum=0,ans=0;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>a;
if(a==1&&ans==0)
{
sum++;
}
else
{
ans=1;
}
}
if(sum==n)
{
if(n%2==0)
{
cout<<"Second"<<endl;
}
else
{
cout<<"First"<<endl;
}
}
else
{
if(sum%2==0)
{
cout<<"First"<<endl;
}
else
{
cout<<"Second"<<endl;
}
}
}
return 0;
}