-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfb1at.cpp
48 lines (39 loc) · 796 Bytes
/
fb1at.cpp
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pi = pair<ll, ll>;
using vi = vector<ll>;
const int INF = 1e9;
void solve() {
int n;
cin >> n;
vector<char> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
char c = '\0';
int ans = 0;
for (int i = 0; i < n; i++) {
if (a[i] == 'F') continue;
if(a[i] == 'O') {
if (c == 'X') ans++;
c = 'O';
}
if (a[i] == 'X') {
if (c == 'O') ans++;
c = 'X';
}
}
cout << ans << endl;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
for (int i = 1; i <= t; i++) {
cout << "Case #" << i << ": ";
solve();
}
return 0;
}