Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- typedef long long ll;
- using namespace std;
- int tA = 0, tC = 0, tB = 0, tK1 = 0, tK2 = 0, tK3 = 0, tK4 = 0;
- void K4(char ch){
- tC = tK4 + 4;
- }
- void K3(char ch){
- if (ch == 'B'){
- tB = tK3 + 2;
- }
- else{
- tC = tK3 + 4;
- }
- }
- void K2(char ch){
- tB = tK2 + 2;
- }
- void K1(char ch){
- if (ch == 'B'){
- if (tK3 <= tK2){
- tK3 = tK1 + 4;
- K3(ch);
- }
- else{
- tK2 = tK1 + 6;
- K2(ch);
- }
- }
- else{
- if (tK3 <= tK4){
- tK3 = tK1 + 8;
- K3(ch);
- }
- else {
- tK4 = tK1 + 12;
- K4(ch);
- }
- }
- }
- void A(char ch){
- if (ch == 'B'){
- tK1 += 1;
- }
- else tK1 += 2;
- K1(ch);
- }
- int main(){
- for (int i = 0; i < 16; ++i){
- char ch;
- cin >> ch;
- A(ch);
- }
- cout << max(tB, tC);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement