温馨提示: \color{#E74C3C}\text{温馨提示:} 温馨提示:
遇见题解勿抄袭,棕名封号两行泪。 \color{#E74C3C}\text{遇见题解勿抄袭,棕名封号两行泪。} 遇见题解勿抄袭,棕名封号两行泪。
思路
我们模拟一下,就可以发现只要输入里有一行是8个 R
,那么答案即为 R
,因为如果答案是 B
的话,总有一列是全 B
的,就不会出现一行全是 R
的情况了。
Code \text{Code} Code
#include <bits/stdc++.h>
using namespace std;
int a[101];
int main()
{
int t;cin>>t;
while (t--)
{
bool flag=0;
string s;
for (int i=1;i<=8;i++)
{
cin>>s;
if(count(s.begin(), s.end(), 'R')==8) flag=1; //计数
}
if(flag) printf("R\n");
else printf("B\n");
}
return 0;
}