当前位置:网站首页>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;
}边栏推荐
- WPF 测量字符串显示大小
- 导航 实验【微机原理】【实验】
- Clock tree synthesis (CTS)
- 亚马逊商品详情API接口-(item_get-获得AMAZON商品详情接口),亚马逊详情API接口
- 唯品会商品详情API接口(item_get-获得唯品会商品详情接口),唯品会详情API接口
- DB queries the database, merges two unrelated tables, adds non-existent fields, and assigns default values
- Application of VoIP push in overseas audio and video services
- 【ROS进阶篇】第三讲 ROS文件系统与分布式通信
- Explain PBR texture maps
- How can colleges and universities build future oriented smart campus based on cloud native? Full stack cloud native vs traditional technology architecture
猜你喜欢
![Navigation experiment [microcomputer principle] [experiment]](/img/79/8311a409113331e72f650a83351b46.png)
Navigation experiment [microcomputer principle] [experiment]

Recruit | DBA Data Engineer every week with an annual salary of 35+. Dream of Kyushu and bright stars!

Viewing technological changes through Huawei Corps (V): smart Park

How to judge the quality of conductive slip ring from its appearance

Detailed description of gaussdb (DWS) complex and diverse resource load management methods

Clock tree synthesis (CTS)

Advances in computational imaging

Implementation and Simulation of ads131a04 ADC Verilog


CORDIC based Signal Processor desgn
随机推荐
导航 习题【微机原理】【习题】
Recommended books -- walking in the daytime and at night
Advances in computational imaging
Star ring technology data security management platform defender heavy release
Is it safe to open a securities account in Caixue school?
Design of VHDL telephone billing system
空间导电盘式滑环材料的选择
【ROS进阶篇】第四讲 ROS中的重名问题(节点、话题与参数)
唯品会关键词搜索API接口(item_search-按关键字搜索唯品会商品API接口),唯品会API接口
[advanced ROS] Lecture 3 ROS file system and distributed communication
CORDIC based Signal Processor desgn
STM32最小系统搭建(原理图)
Win10 add SSH public key
导航 实验【微机原理】【实验】
【云原生实战】KubeSphere实战——多租户系统实战
Realize inotify and Rsync real-time backup
I want to register my stock account online. How do I do it? In addition, is it safe to open a mobile account?
flutter BottomNavigationBar切换页面保持状态
Knowledge distilling learning notes
直播预告 | PostgreSQL 内核解读系列第一讲:PostgreSQL 系统概述