题解:CF2030C A TRUE Battle
Wide_Master · · 题解
博弈论。
同时,因为 and 比 or 的优先级高。
那么,Alice 可以将 or 放在两个连续的
最后,如果头尾均没有
代码:
//By Wide_Master
#include<bits/stdc++.h>
using namespace std;
int T,n,f;
string s;
signed main()
{
cin>>T;
while(T--){
cin>>n;
cin>>s;
s=" "+s;
f=0;
if(s[1]=='1'||s[n]=='1'){
puts("YES");
continue;
}
for(int i=1;i<n;i++){
if(s[i]=='1'&&s[i+1]=='1'){
f=1;
break;
}
}
if(f) puts("YES");
else puts("NO");
}
}