AT_abc463_b.Train Reservation
入门
通过率:0%
时间限制:2.00s
内存限制:1024MB
AC君温馨提醒
该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Takahashi is trying to reserve a seat on a train.
There are N trains he is considering as candidates for reservation, numbered 1,2,…,N. Each train has seats in five columns, called column A, column B, column C, column D, and column E.
The current seat availability information for each train is given as strings S1,S2,…,SN. Here, S1,S2,…,SN all have length 5, and columns A through E of train i correspond to the first through fifth characters of Si, respectively. If that character is o, there is a vacant seat in the corresponding column; if it is x, there is no vacant seat in the corresponding column.
Takahashi wants to reserve a seat in column X, where X is one of A, B, C, D, E. Determine whether there is a vacant seat in column X on at least one train.
高桥正在尝试预订一列火车的座位。
他考虑了 N 列候选火车,编号为 1,2,…,N。每列火车的座位分为五列,分别称为 A 列、B 列、C 列、D 列和 E 列。
每列火车当前的座位可用信息以字符串 S1,S2,…,SN 给出。其中,S1,S2,…,SN 的长度均为 5,且第 i 列火车的 A 至 E 列分别对应于字符串 Si 的第 1 至第 5 个字符。若该字符为 o,表示对应列有空座位;若为 x,则表示对应列无空座位。
高桥希望预订第 X 列的座位,其中 X 是 A、B、C、D、E 中的一个。请判断是否至少存在一列火车,在其第 X 列中有空座位。
输入格式
The input is given from Standard Input in the following format:
N X
S1
S2
⋮
SN
输入从标准输入中按以下格式给出:
N X
S1
S2
⋮
SN
输出格式
If there is a vacant seat in column X on at least one train, output Yes; otherwise, output No.
如果至少有一列火车在第 X 列存在空座位,则输出 Yes;否则,输出 No。
输入输出样例
输入#1
3 A xoxox xxooo oxxxx
输出#1
Yes
输入#2
5 C xoxoo oxxoo oxxxo xoxxx oxxoo
输出#2
No
说明/提示
Sample 1 Explanation:
Train 3 has a vacant seat in column A. Thus, output Yes.
Sample 2 Explanation:
No train has a vacant seat in column C. Thus, output No.
Constraints
- N is an integer between 1 and 100, inclusive.
- X is one of
A,B,C,D,E. - Si is a string of length 5 consisting of
oandx.
样例 1 解释:
列车 3 的 A 列有一个空座位。因此,输出 Yes。
样例 2 解释:
没有任何列车的 C 列有空座位。因此,输出 No。
约束条件
- N 是一个介于 1 到 100(含)之间的整数。
- X 是
A、B、C、D、E中的一个字符。 - Si 是一个长度为 5 的字符串,仅由字符
o和x组成。
输入解题思路,AI测评打分。不知道怎么写?