A - Job Interview

Time Limit: 2 sec / Memory Limit: 1024 MiB

配点 : 100

問題文

高橋君はある会社の採用面接を受けました。

面接官の人数 N と、各面接官の高橋君への評価を表す長さ N の文字列 S が与えられます。
i=1,2,\ldots,N に対し Si 文字目が i 番目の面接官の評価に対応し、o は「良」、- は「可」、x は 「不可」を表します。

高橋君は以下の 2 つの条件を両方満たすならば合格、そうでなければ不合格です。

  • 「良」と評価した面接官が少なくとも 1 人いる
  • 「不可」と評価した面接官がいない

高橋君が合格かどうかを判定してください。

制約

  • 1 \leq N \leq 100
  • So, -, x のみからなる長さが N の文字列

入力

入力は以下の形式で標準入力から与えられる。

N
S

出力

高橋君が合格ならば Yes と、そうでなければ No と出力せよ。


入力例 1

4
oo--

出力例 1

Yes

1, 2 番目の面接官が「良」と評価していて、さらに「不可」と評価した面接官がいないため合格です。


入力例 2

3
---

出力例 2

No

「良」と評価した面接官が 1 人もいないため不合格です。


入力例 3

1
o

出力例 3

Yes

入力例 4

100
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooox

出力例 4

No

100 番目の面接官が「不可」と評価しているため不合格です。

Score : 100 points

Problem Statement

Takahashi had a job interview.

You are given the number of interviewers, N, and a string S of length N representing the interviewers' evaluations of him.
For each i=1,2,\ldots,N, the i-th character of S corresponds to the i-th interviewer's evaluation; o means Good, - means Fair, and x means Poor.

Takahashi will pass if both of the following conditions are satisfied, and fail otherwise.

  • At least one interviewer's evaluation is Good.
  • No interviewer's evaluation is Poor.

Determine whether Takahashi passes.

Constraints

  • 1 \leq N \leq 100
  • S is a string of length N consisting of o, -, and x.

Input

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

N
S

Output

If Takahashi passes, print Yes; otherwise, print No.


Sample Input 1

4
oo--

Sample Output 1

Yes

The first and second interviewers' evaluations are Good, and no interviewer's evaluation is Poor, so he passes.


Sample Input 2

3
---

Sample Output 2

No

No interviewer's evaluation is Good, so he fails.


Sample Input 3

1
o

Sample Output 3

Yes

Sample Input 4

100
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooox

Sample Output 4

No

The 100-th interviewer's evaluation is Poor, so he fails.

B - Long Loong

Time Limit: 2 sec / Memory Limit: 1024 MiB

配点 : 100

問題文

正の整数 X について、レベル X龍文字列 とは、1 個の L, X 個の o, 1 個の n, 1 個の g をこの順に並べた長さ (X+3) の文字列です。

正の整数 N が与えられるので、レベル N の龍文字列を出力してください。
大文字と小文字は区別されることに注意してください。

制約

  • 1\leq N\leq 2024
  • N は整数

入力

入力は以下の形式で標準入力から与えられる。

N

出力

レベル N の龍文字列を出力せよ。


入力例 1

3

出力例 1

Looong

1 個の L, 3 個の o, 1 個の n, 1 個の g をこの順に並べた文字列は Looong です。


入力例 2

1

出力例 2

Long

Score: 100 points

Problem Statement

For a positive integer X, the Dragon String of level X is a string of length (X+3) formed by one L, X occurrences of o, one n, and one g arranged in this order.

You are given a positive integer N. Print the Dragon String of level N.
Note that uppercase and lowercase letters are distinguished.

Constraints

  • 1 \leq N \leq 2024
  • N is an integer.

Input

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

N

Output

Print the Dragon String of level N.


Sample Input 1

3

Sample Output 1

Looong

Arranging one L, three os, one n, and one g in this order yields Looong.


Sample Input 2

1

Sample Output 2

Long
C - 3-smooth Numbers

Time Limit: 2 sec / Memory Limit: 1024 MiB

配点 : 200

問題文

正の整数 N が与えられます。 N=2^x3^y を満たす整数 x,y が存在するなら Yes 、そうでなければ No と出力してください。

制約

  • 1\leq N\leq10^{18}
  • N は整数

入力

入力は以下の形式で標準入力から与えられる。

N

出力

条件を満たす整数 x,y が存在するなら Yes 、そうでなければ No1 行に出力せよ。


入力例 1

324

出力例 1

Yes

x=2,y=4 とすると、2^x3^y=2^23^4=4\times81=324 となるため条件を満たします。 よって、Yes と出力してください。


入力例 2

5

出力例 2

No

どのような整数 x,y をとっても 2^x3^y=5 とすることはできません。 よって、No と出力してください。


入力例 3

32

出力例 3

Yes

x=5,y=0 とすると、2^x3^y=32\times1=32 となるため、Yes と出力してください。


入力例 4

37748736

出力例 4

Yes

Score : 200 points

Problem Statement

You are given a positive integer N. If there are integers x and y such that N=2^x3^y, print Yes; otherwise, print No.

Constraints

  • 1\leq N\leq10^{18}
  • N is an integer.

Input

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

N

Output

Print a single line containing Yes if there are integers x and y that satisfy the condition, and No otherwise.


Sample Input 1

324

Sample Output 1

Yes

For x=2,y=4, we have 2^x3^y=2^23^4=4\times81=324, so the condition is satisfied. Thus, you should print Yes.


Sample Input 2

5

Sample Output 2

No

There are no integers x and y such that 2^x3^y=5. Thus, you should print No.


Sample Input 3

32

Sample Output 3

Yes

For x=5,y=0, we have 2^x3^y=32\times1=32, so you should print Yes.


Sample Input 4

37748736

Sample Output 4

Yes
D - A Reverse

Time Limit: 2 sec / Memory Limit: 1024 MiB

配点 : 200

問題文

整数 L,R と、英小文字のみからなる文字列 S が与えられます。
SL 文字目から R 文字目までの部分を反転した(すなわち、 L 文字目から R 文字目までの文字の並びを逆にした)文字列を出力してください。

制約

  • S は英小文字のみからなる。
  • 1 \le |S| \le 10^5 (|S|S の長さ)
  • L,R は整数
  • 1 \le L \le R \le |S|

入力

入力は以下の形式で標準入力から与えられる。

L R
S

出力

問題文の指示通り出力せよ。


入力例 1

3 7
abcdefgh

出力例 1

abgfedch

abcdefgh3 文字目から 7 文字目までの部分を反転すると、 abgfedch となります。


入力例 2

1 7
reviver

出力例 2

reviver

操作を行った結果が元の文字列と同一であることもあります。


入力例 3

4 13
merrychristmas

出力例 3

meramtsirhcyrs

Score : 200 points

Problem Statement

You are given integers L, R, and a string S consisting of lowercase English letters.
Print this string after reversing (the order of) the L-th through R-th characters.

Constraints

  • S consists of lowercase English letters.
  • 1 \le |S| \le 10^5 (|S| is the length of S.)
  • L and R are integers.
  • 1 \le L \le R \le |S|

Input

Input is given from Standard Input in the following format:

L R
S

Output

Print the specified string.


Sample Input 1

3 7
abcdefgh

Sample Output 1

abgfedch

After reversing the 3-rd through 7-th characters of abcdefgh, we have abgfedch.


Sample Input 2

1 7
reviver

Sample Output 2

reviver

The operation may result in the same string as the original.


Sample Input 3

4 13
merrychristmas

Sample Output 3

meramtsirhcyrs
E - AtCoder Cards

Time Limit: 2 sec / Memory Limit: 1024 MiB

配点 : 300

問題文

AtCoder社ではカードを使った 1 人ゲームが流行っています。
ゲームで使う各カードには、英小文字 1 文字または @ の文字が書かれており、いずれのカードも十分多く存在します。
ゲームは以下の手順で行います。

  1. カードを同じ枚数ずつ 2 列に並べる。
  2. @ のカードを、それぞれ a, t, c, o, d, e, r のいずれかのカードと置き換える。
  3. 2 つの列が一致していれば勝ち。そうでなければ負け。

このゲームに勝ちたいあなたは、次のようなイカサマをすることにしました。

  • 手順 1 以降の好きなタイミングで、列内のカードを自由に並び替えてよい。

手順 1 で並べられた 2 つの列を表す 2 つの文字列 S,T が与えられるので、イカサマをしてもよいときゲームに勝てるか判定してください。

制約

  • S,T は英小文字と @ からなる
  • S,T の長さは等しく 1 以上 2\times 10^5 以下

入力

入力は以下の形式で標準入力から与えられる。

S
T

出力

イカサマをしてもよいとき、ゲームに勝てるなら Yes、勝てないなら No と出力せよ。


入力例 1

ch@ku@ai
choku@@i

出力例 1

Yes

@ をうまく置き換えることによって、両方とも chokudai と一致させることが可能です。


入力例 2

ch@kud@i
akidu@ho

出力例 2

Yes

イカサマをし、@ をうまく置き換えることによって、両方とも chokudai と一致させることが可能です。


入力例 3

aoki
@ok@

出力例 3

No

イカサマをしても勝つことはできません。


入力例 4

aa
bb

出力例 4

No

Score : 300 points

Problem Statement

A single-player card game is popular in AtCoder Inc. Each card in the game has a lowercase English letter or the symbol @ written on it. There is plenty number of cards for each kind. The game goes as follows.

  1. Arrange the same number of cards in two rows.
  2. Replace each card with @ with one of the following cards: a, t, c, o, d, e, r.
  3. If the two rows of cards coincide, you win. Otherwise, you lose.

To win this game, you will do the following cheat.

  • Freely rearrange the cards within a row whenever you want after step 1.

You are given two strings S and T, representing the two rows you have after step 1. Determine whether it is possible to win with cheating allowed.

Constraints

  • S and T consist of lowercase English letters and @.
  • The lengths of S and T are equal and between 1 and 2\times 10^5, inclusive.

Input

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

S
T

Output

If it is possible to win with cheating allowed, print Yes; otherwise, print No.


Sample Input 1

ch@ku@ai
choku@@i

Sample Output 1

Yes

You can replace the @s so that both rows become chokudai.


Sample Input 2

ch@kud@i
akidu@ho

Sample Output 2

Yes

You can cheat and replace the @s so that both rows become chokudai.


Sample Input 3

aoki
@ok@

Sample Output 3

No

You cannot win even with cheating.


Sample Input 4

aa
bb

Sample Output 4

No