본문 바로가기

Algorithm

C++(씨쁠쁠)(cplusplus)-백준(baekjoon)(BaekJoon)코딩 10102번:개표 답

반응형
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>
#include <string>
using namespace std;
int main() {
    int v,a=0,b=0;
    string k;
    cin >> v >> k;
    for (int i = 0; i < v; i++)
    {
        if (k[i] == 'A')
            a++;
        else
            b++;
    }
    if (a == b) { cout << "Tie" << '\n';}
    else
        printf("%c\n", a < b ? 'B' : 'A');
}
cs