103810: [Atcoder]ABC381 A - 11/22 String

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:28 Solved:0

Description

Score : $150$ points

Problem Statement

The definition of an 11/22 string in this problem is the same as in Problems C and E.

A string $T$ is called an 11/22 string when it satisfies all of the following conditions:

  • $|T|$ is odd. Here, $|T|$ denotes the length of $T$.
  • The $1$-st through $(\frac{|T|+1}{2} - 1)$-th characters are all 1.
  • The $(\frac{|T|+1}{2})$-th character is /.
  • The $(\frac{|T|+1}{2} + 1)$-th through $|T|$-th characters are all 2.

For example, 11/22, 111/222, and / are 11/22 strings, but 1122, 1/22, 11/2222, 22/11, and //2/2/211 are not.

Given a string $S$ of length $N$ consisting of 1, 2, and /, determine whether $S$ is an 11/22 string.

Constraints

  • $1 \leq N \leq 100$
  • $S$ is a string of length $N$ consisting of 1, 2, and /.

Input

The input is given from Standard Input in the following format:

$N$
$S$

Output

If $S$ is an 11/22 string, print Yes; otherwise, print No.


Sample Input 1

5
11/22

Sample Output 1

Yes

11/22 satisfies the conditions for an 11/22 string in the problem statement.


Sample Input 2

1
/

Sample Output 2

Yes

/ satisfies the conditions for an 11/22 string.


Sample Input 3

4
1/22

Sample Output 3

No

1/22 does not satisfy the conditions for an 11/22 string.


Sample Input 4

5
22/11

Sample Output 4

No

Output

得分:150分

问题陈述

这个问题中11/22字符串的定义与问题C和E中的定义相同。

当一个字符串$T$满足以下所有条件时,它被称为11/22字符串

  • $|T|$是奇数。这里,$|T|$表示$T$的长度。
  • 从第1个到第$(\frac{|T|+1}{2} - 1)$个字符全部是1
  • 第$(\frac{|T|+1}{2})$个字符是/
  • 从第$(\frac{|T|+1}{2} + 1)$个到第$|T|$个字符全部是2

例如,11/22111/222/是11/22字符串,但是11221/2211/222222/11//2/2/211不是。

给定一个由12/组成的长度为$N$的字符串$S$,判断$S$是否是11/22字符串。

约束条件

  • $1 \leq N \leq 100$
  • $S$是由12/组成的长度为$N$的字符串。

输入

输入从标准输入以下格式给出:

$N$
$S$

输出

如果$S$是11/22字符串,打印Yes;否则,打印No


样本输入1

5
11/22

样本输出1

Yes

11/22满足问题陈述中11/22字符串的条件。


样本输入2

1
/

样本输出2

Yes

/满足问题陈述中11/22字符串的条件。


样本输入3

4
1/22

样本输出3

No

1/22不满足问题陈述中11/22字符串的条件。


样本输入4

5
22/11

样本输出4

No

加入题单

上一题 下一题 算法标签: