当前位置:网站首页>C. Where‘s the Bishop?
C. Where‘s the Bishop?
2022-06-29 21:35:00 【Felven】
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
Mihai has an 8×88×8 chessboard whose rows are numbered from 11 to 88 from top to bottom and whose columns are numbered from 11 to 88 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 22 and 77, 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.
Input
The first line of the input contains a single integer tt (1≤t≤361≤t≤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 88 lines, each containing 88 characters. Each of these characters is either '#' or '.', denoting a square under attack and a square not under attack, respectively.
Output
For each test case, output two integers rr and cc (2≤r,c≤72≤r,c≤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.
Example
input
Copy
3 .....#.. #...#... .#.#.... ..#..... .#.#.... #...#... .....#.. ......#. #.#..... .#...... #.#..... ...#.... ....#... .....#.. ......#. .......# .#.....# ..#...#. ...#.#.. ....#... ...#.#.. ..#...#. .#.....# #.......
output
Copy
4 3 2 2 4 5
Note
The first test case is pictured in the statement. Since the bishop lies in the intersection row 44 and column 33, the correct output is 4 3.
Problem solving instructions : This question only needs to find the cross position , The simplest way is to traverse the entire chessboard , Find one 3X3 There are four directions in the square of # The location of , Then take the center .
#include"stdio.h"
#include"math.h"
int main()
{
char arr[9][9];
int a, b, t;
scanf("%d", &t);
while (t--)
{
for (int i = 1; i <= 8; i++)
{
for (int j = 1; j <= 8; j++)
{
scanf(" %c", &arr[i][j]);
}
}
for (int i = 1; i <= 8; i++)
{
for (int j = 1; j <= 8; j++)
{
if (arr[i][j] == '#' && arr[i][j + 2] == '#' && arr[i + 2][j] == '#'&&arr[i + 2][j + 2] == '#')
{
a = i + 1;
b = j + 1;
break;
}
}
}
printf("%d %d\n", a, b);
}
return 0;
}边栏推荐
- Goahead webserver migration
- STL tutorial 6-deque, stack, queue, list container
- STL教程6-deque、stack、queue、list容器
- Star ring technology data security management platform defender heavy release
- GoAhead 翻译—Active Server Pages
- Flutter technology and Practice (2)
- leetcode:724. Find the central subscript of the array
- 《强化学习周刊》第51期:PAC、ILQL、RRL&无模型强化学习集成于微电网络格控制:综述与启示
- How can colleges and universities build future oriented smart campus based on cloud native? Full stack cloud native vs traditional technology architecture
- 如何从外表判断导电滑环的质量
猜你喜欢

报表交付工程师

不同系统下的文件层级符号小结

leetcode:238. 除自身以外数组的乘积

Verilog implements DDS waveform generator module, which can realize adjustable frequency and phase, three waveforms

ads131a04 ADC verilog实现及仿真

《强化学习周刊》第51期:PAC、ILQL、RRL&无模型强化学习集成于微电网络格控制:综述与启示

每周招聘|DBA数据工程师,年薪35+ ,梦起九州,星河灿烂!

广东二级造价工程师《造价管理》真题解析

Analysis of the factors affecting the transmission signal of the conductive slip ring

Verilog realizes serial communication and sends it to the nixie tube
随机推荐
Varnish 503 no backend connection – varnish health check
Yolov6 training your own data record +yolov5 comparison test
Basic qualities of management personnel
一颗新的北极星已经升起!
WPF measurement string display size
DB queries the database, merges two unrelated tables, adds non-existent fields, and assigns default values
Selection of materials for space conductive disc slip ring
yolov6训练自己的数据记录+yolov5对比测试
String类的常用方法
Implementation and Simulation of ads131a04 ADC Verilog
【摸鱼神器】UI库秒变低代码工具——表单篇(一)设计
Amazon Product details API interface - (item_get get Amazon Product details interface), Amazon details API interface
LSF bsub command
STL tutorial 6-deque, stack, queue, list container
亚马逊商品详情API接口-(item_get-获得AMAZON商品详情接口),亚马逊详情API接口
什么是 SYN 洪水攻击?如何防护?
唯品会商品详情API接口(item_get-获得唯品会商品详情接口),唯品会详情API接口
炒股开户请问哪个券商佣金是最低最安全的
我的创作纪念日
如何从外表判断导电滑环的质量