Skip to content

Commit fe33a66

Browse files
committed
c++ code solution for stripes
1 parent 26694a1 commit fe33a66

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

stripes.cpp

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
2+
#include <bits/stdc++.h>
3+
using namespace std;
4+
#define ll long long
5+
#define pi (3.141592653589)
6+
#define mod 1000000007
7+
#define ll long long
8+
#define float double
9+
#define pb push_back
10+
#define mp make_pair
11+
#define ff first
12+
#define ss second
13+
#define all(c) c.begin(), c.end()
14+
#define min3(a, b, c) min(c, min(a, b))
15+
#define min4(a, b, c, d) min(d, min(c, min(a, b)))
16+
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
17+
#define rep(i, n) for (int i = 0; i < n; i++)
18+
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
19+
20+
int main()
21+
{
22+
int t;
23+
cin >> t;
24+
while (t--)
25+
{
26+
int red = 0, ak = 0;
27+
string a[8];
28+
for (int i = 0; i < 8; i++)
29+
{
30+
cin >> a[i];
31+
}
32+
int flag = 0;
33+
for (int i = 0; i < 8; i++)
34+
{
35+
red = 0;
36+
for (int j = 0; j < 8; j++)
37+
{
38+
if (a[i][j] == 'R')
39+
red++;
40+
}
41+
if (red == 8)
42+
{
43+
cout << "R" << endl;
44+
flag = 1;
45+
break;
46+
}
47+
}
48+
if (!flag)
49+
{
50+
for (int i = 0; i < 8; i++)
51+
{
52+
ak = 0;
53+
for (int j = 0; j < 8; j++)
54+
{
55+
if (a[j][i] == 'B')
56+
ak++;
57+
}
58+
if (ak == 8)
59+
{
60+
cout << "B" << endl;
61+
break;
62+
}
63+
}
64+
}
65+
}
66+
return 0;
67+
}

0 commit comments

Comments
 (0)