1742C - Stripes - CodeForces Solution


implementation

Please click on ads to support us..

Python Code:

for i in range(int(input())):
    values=[]
    s=input()
    for k in range(8):
        st=input()
        values.append(st)
    if "RRRRRRRR" in values:
        print("R")
    else:
        j = 0
        while j < 8 :
            if values[0][j]==values[1][j] == values[2][j] == values[3][j] == values[4][j] == values[5][j] ==values[6][j] == values[7][j] == "B":
                print("B")
                break
            j += 1

C++ Code:

#include<iostream>
#include<string>
#include<cmath>
#include<set>
#include<algorithm>
#include<iomanip>
#include<vector>
#include<map>

using namespace std;

void solve() {
    int cnt = 0;
    string arr;
    for (int i = 0; i < 8; i++) {
        string arr; cin >> arr;
        if (arr == "RRRRRRRR")
            cnt++;
    }

    if (cnt >= 1) cout << "R" << endl;
    else  cout << "B" << endl;
}

int main() {
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int t = 1;  cin >> t;
    for (int x = 0; x < t; x++) {
        solve();
    }
    return 0;
}


Comments

Submit
0 Comments
More Questions

1133A - Middle of the Contest
385A - Bear and Raspberry
1311B - WeirdSort
1713F - Lost Array
236B - Easy Number Challenge
275A - Lights Out
147A - Punctuation
253A - Boys and Girls
1327E - Count The Blocks
984A - Game
12B - Correct Solution
1355B - Young Explorers
485A - Factory
628A - Tennis Tournament
1436B - Prime Square
1707B - Difference Array
1422C - Bargain
1611F - ATM and Students
660A - Co-prime Array
1692F - 3SUM
1470A - Strange Birthday Party
190D - Non-Secret Cypher
1721B - Deadly Laser
1721C - Min-Max Array Transformation
1721A - Image
1180C - Valeriy and Deque
557A - Ilya and Diplomas
1037D - Valid BFS
1144F - Graph Without Long Directed Paths
1228A - Distinct Digits