网站建设 公司 广州,今天出入深圳最新规定,建立一个网站英语,网站为什么会被挂马CF1692C Wheres the Bishop? 题解题目链接字面描述题面翻译题目描述题目描述输入格式输出格式样例 #1样例输入 #1样例输出 #1提示代码实现题目
链接
https://www.luogu.com.cn/problem/CF1692C
字面描述
题面翻译
题目描述
有一个888\times888的棋盘#xff0c;列编号从…
CF1692C Wheres the Bishop? 题解题目链接字面描述题面翻译题目描述题目描述输入格式输出格式样例 #1样例输入 #1样例输出 #1提示代码实现题目
链接
https://www.luogu.com.cn/problem/CF1692C
字面描述
题面翻译
题目描述
有一个8×88\times88×8的棋盘列编号从左到右递增行编号从上到下递增。
给出一个棋盘上面用KaTeX parse error: Expected EOF, got # at position 1: #̲标明了主教的攻击范围。请你找出主教的位置坐标并输出其行、列编号。
保证主教的行、列编号均在222与777之间。
你需要回答ttt组测试数据。 (1≤t≤36)(1\le t \le 36)(1≤t≤36)
题目描述
Mihai has an $ 8 \times 8 $ chessboard whose rows are numbered from $ 1 $ to $ 8 $ from top to bottom and whose columns are numbered from $ 1 $ to $ 8 $ from left to right.
Mihai has placed exactly one bishop on the chessboard. The bishop is not placed on the edges of the board. (In other words, the row and column of the bishop are between $ 2 $ and $ 7 $ , inclusive.)
The bishop attacks in all directions diagonally, and there is no limit to the distance which the bishop can attack. Note that the cell on which the bishop is placed is also considered attacked.
An example of a bishop on a chessboard. The squares it attacks are marked in red.Mihai has marked all squares the bishop attacks, but forgot where the bishop was! Help Mihai find the position of the bishop.
输入格式
The first line of the input contains a single integer $ t $ ( $ 1 \leq t \leq 36 $ ) — 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 ‘#’ or ‘.’, denoting a square under attack and a square not under attack, respectively.
输出格式
For each test case, output two integers $ r $ and $ c $ ( $ 2 \leq r, c \leq 7 $ ) — the row and column of the bishop.
The input is generated in such a way that there is always exactly one possible location of the bishop that is not on the edge of the board.
样例 #1
样例输入 #1
3.....#..
#...#...
.#.#....
..#.....
.#.#....
#...#...
.....#..
......#.#.#.....
.#......
#.#.....
...#....
....#...
.....#..
......#.
.......#.#.....#
..#...#.
...#.#..
....#...
...#.#..
..#...#.
.#.....#
#.......样例输出 #1
4 3
2 2
4 5提示
The first test case is pictured in the statement. Since the bishop lies in the intersection row $ 4 $ and column $ 3 $ , the correct output is 4 3.
代码实现
遍历每一个点看他的四个角和本身是不是#即可
#includebits/stdc.h
using namespace std;const int maxn20;
int t;
char a[maxn][maxn];
inline bool inbound(int x,int y){return x1x8y1y8;}
int main(){scanf(%d,t);while(t--){for(int i1;i8;i){for(int j1;j8;j)scanf( %c,a[i][j]);}bool flagfalse;for(int i1;i8;i){for(int j1;j8;j){if(a[i][j]#a[i-1][j1]#a[i-1][j-1]#a[i1][j-1]#a[i1][j1]#){printf(%d %d\n,i,j);break;}}if(flag)break;}}return 0;
}