题目描述
blablabla
样例
blablabla
算法1
简单的博弈题,单数raze有掌控权偶数breeze有掌控权
时间复杂度
参考文献
C++ 代码
#include <iostream>
#include <cstring>
#include <algorithm>
#include <queue>
#include <map>
#include <unordered_map>
#include <cmath>
#include <cstdio>
#include <vector>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e9;
typedef pair<int,int> pii;
int t;
int main()
{
cin >> t;
while(t--){
int n;
cin >> n;
string s;
int flag1 = 1, flag2 = 1;
cin >> s;
if (n % 2) {
for (int i = 0; i < n;i++){
if(i%2==0){
int temp = s[i] - '0';
if (temp%2){
cout << 1 << endl;
flag1 = 0;
break;
}
}
}
if(flag1)
cout << 2 << endl;
} else {
for (int i = 0; i < n;i++){
if(i%2){
int temp = s[i] - '0';
if(temp%2==0){
cout << 2 << endl;
flag2 = 0;
break;
}
}
}
if(flag2)
cout << 1 << endl;
}
}
}