๐Ÿ“ฆ ved015 / Codeforces-solution

๐Ÿ“„ palindrome1200.cpp ยท 29 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29#include <iostream>
#include <string>
using namespace std;

int main() {
    int t;
    cin >> t;
    while (t--){
        int n;
        cin >> n;
        string s;
        cin >> s;
        int count = 0;
        for (char it : s){
            if(it == '0') count++;
        }
        if(count == 1){
            cout << "BOB" << endl;
        }
        else if(count & 1){
            cout << "ALICE" << endl;
        }
        else{
            cout << "BOB" << endl;
        }
    }
    return 0;
}