题目链接
第一次做博弈的题目,自然是不会。。。
参考了博客地址
#include<bits/stdc++.h>
using namespace std;
int a[100005];
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
int first = 1, second = 0;
for (int i = 0; i < n; i++)
{
if (a[i] == 1)
{
if (first == 1)
{
first = 0;
second = 1;
}
else if (second == 1)
{
first = 1;
second = 0;
}
}
else
{
if (first == 1)
{
first = 1;
second = 1;
}
else
{
first = 0;
second = 0;
}
break;
}
}
if (second == 1) cout << "First" << endl;
else cout << "Second" << endl;
}
return 0;
}