AT_abc480_a.ADjacent
入门
通过率:0%
时间限制:2.00s
内存限制:1024MB
AC君温馨提醒
该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
There is a grid with 2 rows and 2 columns.
Each cell of the grid contains exactly one of A, B, C, and D, and the characters written in the 4 cells are distinct. The cell at the i-th row from the top and the j-th column from the left contains Si,j.
If the cell containing A and the cell containing D are adjacent, that is, they share an edge, print Yes; otherwise, print No.
有一个 2 行 2 列的网格。
网格的每个单元格中恰好包含 A、B、C、D 中的一个字符,且这 4 个单元格中的字符互不相同。位于从上往下第 i 行、从左往右第 j 列的单元格中包含字符 Si,j。
如果包含 A 的单元格与包含 D 的单元格相邻(即它们有一条公共边),则输出 Yes;否则输出 No。
输入格式
The input is given from Standard Input in the following format:
S1,1S1,2
S2,1S2,2
输入从标准输入给出,格式如下:
S1,1S1,2
S2,1S2,2
输出格式
Print the answer in a single line.
在一行中输出答案。
输入输出样例
输入#1
AB DC
输出#1
Yes
输入#2
AB CD
输出#2
No
输入#3
BD CA
输出#3
Yes
说明/提示
Sample 1 Explanation:
A is written in the cell at the 1-st row from the top and the 1-st column from the left.
D is written in the cell at the 2-nd row from the top and the 1-st column from the left.
These 2 cells share an edge, so they are adjacent.
Constraints
- Si,j is one of
A,B,C, andD. - If (i1,j1)=(i2,j2), then Si1,j1 and Si2,j2 are distinct.
样例 1 解释:
字符 A 写在从上往下数第 1 行、从左往右数第 1 列的格子中。
字符 D 写在从上往下数第 2 行、从左往右数第 1 列的格子中。
这两个格子有一条公共边,因此它们是相邻的。
约束条件
- Si,j 是
A、B、C、D中的一个。 - 若 (i1,j1)=(i2,j2),则 Si1,j1 与 Si2,j2 互不相同。
输入解题思路,AI测评打分。不知道怎么写?