题目:
​​​题目链接:​

题解:
先数出有多少个位置不匹配,如果为Codeforces Round #721 (Div. 2) B2. Palindrome Game (hard version)_#include则和Codeforces Round #721 (Div. 2) B2. Palindrome Game (hard version)_博弈论_02一样,如果为Codeforces Round #721 (Div. 2) B2. Palindrome Game (hard version)_i++_03则alice第一轮翻转,bob必须得第一个填,如果0 的数量大于2则bob必败,不匹配位置大于1,则alice必胜

#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
string a;
cin>>a;
int con=0;
for(int i=0;i<n;i++)
{
if(a[i]=='0') con++;
}
int c=0;
for(int i=0,j=n-1;i<j;i++,j--)
{
if(a[i]!=a[j]) c++;
}
if(c==0)
{
if(con%2==0)
{
cout<<"BOB"<<endl;
}
else if(con%2!=0)
{
if(con>1) cout<<"ALICE"<<endl;
else cout<<"BOB"<<endl;
}
}
else if(c==1)
{
if(con==2) cout<<"DRAW"<<endl;
else cout<<"ALICE"<<endl;
}
else cout<<"ALICE"<<endl;
}
return 0;
}