A15389 | Stripes
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
On an $8 \times 8$ grid, some horizontal rows have been painted red, and some vertical columns have been painted blue, in some order. The stripes are drawn sequentially, one after the other. When the stripe is drawn, it repaints all the cells through which it passes.
Determine which color was used last.
The red stripe was painted after the blue one, so the answer is R.
Determine which color was used last.
The red stripe was painted after the blue one, so the answer is R.
输入格式
The first line of the input contains a single integer $t$ ( $1 \leq t \leq 4000$ ) — the number of test cases. The description of test cases follows. There is an empty line before each test case.
Each test case consists of $8$ lines, each containing $8$ characters. Each of these characters is either 'R', 'B', or '.', denoting a red square, a blue square, and an unpainted square, respectively.
It is guaranteed that the given field is obtained from a colorless one by drawing horizontal red rows and vertical blue columns.
At least one stripe is painted.
Each test case consists of $8$ lines, each containing $8$ characters. Each of these characters is either 'R', 'B', or '.', denoting a red square, a blue square, and an unpainted square, respectively.
It is guaranteed that the given field is obtained from a colorless one by drawing horizontal red rows and vertical blue columns.
At least one stripe is painted.
输出格式
For each test case, output 'R' if a red stripe was painted last, and 'B' if a blue stripe was painted last (without quotes).
输入输出样例
输入 #1
4 ....B... ....B... ....B... RRRRRRRR ....B... ....B... ....B... ....B... RRRRRRRB B......B B......B B......B B......B B......B B......B RRRRRRRB RRRRRRBB .B.B..BB RRRRRRBB .B.B..BB .B.B..BB RRRRRRBB .B.B..BB .B.B..BB ........ ........ ........ RRRRRRRR ........ ........ ........ ........
输出 #1
R B B R
The first test case is pictured in the statement.
In the second test case, the first blue column is painted first, then the first and last red rows, and finally the last blue column. Since a blue stripe is painted last, the answer is B.
In the second test case, the first blue column is painted first, then the first and last red rows, and finally the last blue column. Since a blue stripe is painted last, the answer is B.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted