A - On the Way

Time Limit: 2 sec / Memory Limit: 1024 MB

### 制約

• 0\leq A,B,C\leq 100
• A,B,C は相異なる整数である

A B C

### 出力

1 から家 2 まで寄り道をせずにまっすぐ向かう途中で家 3 のある座標を通る場合は Yes を、そうでない場合は No を出力せよ。

3 8 5

Yes

7 3 1

No

10 2 4

Yes

31 41 59

### 出力例 4

No

Score : 100 points

### Problem Statement

There are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively. Print Yes if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print No otherwise.

### Constraints

• 0\leq A,B,C\leq 100
• A, B and C are distinct integers.

### Input

Input is given from Standard Input in the following format:

A B C

### Output

Print Yes if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print No otherwise.

3 8 5

### Sample Output 1

Yes

We pass the coordinate 5 on the straight way from the house at coordinate 3 to the house at coordinate 8.

7 3 1

No

10 2 4

Yes

31 41 59

### Sample Output 4

No
B - *e**** ********e* *e****e* ****e**

Time Limit: 2 sec / Memory Limit: 1024 MB

### 制約

• 1 \leq K \leq N\leq 10
• S は英小文字からなる長さ N の文字列である
• N,K は整数である

N
S
K

### 出力

SK 番目の文字と異なる文字全てを * で置き換えてできる文字列を出力せよ。

5
error
2

### 出力例 1

*rr*r

S2 番目の文字は r であり、errorr と異なる文字をすべて * で置き換えると文字列 *rr*r になります。

6
eleven
5

e*e*e*

9
education
7

### 出力例 3

******i**

Score : 200 points

### Problem Statement

You are given a string S of length N consisting of lowercase English letters, and an integer K. Print the string obtained by replacing every character in S that differs from the K-th character of S, with *.

### Constraints

• 1 \leq K \leq N\leq 10
• S is a string of length N consisting of lowercase English letters.
• N and K are integers.

### Input

Input is given from Standard Input in the following format:

N
S
K

### Output

Print the string obtained by replacing every character in S that differs from the K-th character of S, with *.

5
error
2

### Sample Output 1

*rr*r

The second character of S is r. When we replace every character in error that differs from r with *, we get the string *rr*r.

6
eleven
5

e*e*e*

9
education
7

### Sample Output 3

******i**
C - Stones

Time Limit: 2 sec / Memory Limit: 1024 MB

### 問題文

N 個の石が一列に並んでおり、すべての石は白か黒で塗られています。 石の状態は長さ N の文字列 S で表され、Si 文字目が . のとき左から i 個目の石が白であり、# のとき左から i 個目の石が黒であることを表します。

### 制約

• 1 \leq N \leq 2\times 10^5
• S., # のみからなる長さ N の文字列である

N
S

3
#.#

1

5
#.##.

2

9
.........

### 出力例 3

0

Score : 300 points

### Problem Statement

There are N stones arranged in a row. Every stone is painted white or black. A string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.

Takahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone. Find the minimum number of stones that needs to be recolored.

### Constraints

• 1 \leq N \leq 2\times 10^5
• S is a string of length N consisting of . and #.

### Input

Input is given from Standard Input in the following format:

N
S

### Output

Print the minimum number of stones that needs to be recolored.

3
#.#

### Sample Output 1

1

It is enough to change the color of the first stone to white.

5
#.##.

2

9
.........

### Sample Output 3

0
D - Three Colors

Time Limit: 3 sec / Memory Limit: 1024 MB

### 問題文

N 個の整数が与えられます。i 個目の整数は a_i です。 与えられたすべての整数を赤、緑、青の 3 色のいずれかで塗り、以下の条件を満たすようにする方法の個数を 998244353 で割ったあまりを求めてください。

• 赤、緑、青で塗られた整数の総和をそれぞれ R,G,B とする。三辺の長さがそれぞれ R,G,B であるような正の面積の三角形が存在する。

### 制約

• 3 \leq N \leq 300
• 1 \leq a_i \leq 300(1\leq i\leq N)
• 入力はすべて整数である

N
a_1
:
a_N

4
1
1
1
2

18

6
1
3
2
3
5
2

150

20
3
1
4
1
5
9
2
6
5
3
5
8
9
7
9
3
2
3
8
4

### 出力例 3

563038556

Score : 600 points

### Problem Statement

You are given N integers. The i-th integer is a_i. Find the number, modulo 998244353, of ways to paint each of the integers red, green or blue so that the following condition is satisfied:

• Let R, G and B be the sums of the integers painted red, green and blue, respectively. There exists a triangle with positive area whose sides have lengths R, G and B.

### Constraints

• 3 \leq N \leq 300
• 1 \leq a_i \leq 300(1\leq i\leq N)
• All values in input are integers.

### Input

Input is given from Standard Input in the following format:

N
a_1
:
a_N

### Output

Print the number, modulo 998244353, of ways to paint each of the integers red, green or blue so that the condition is satisfied.

4
1
1
1
2

### Sample Output 1

18

We can only paint the integers so that the lengths of the sides of the triangle will be 1, 2 and 2, and there are 18 such ways.

6
1
3
2
3
5
2

150

20
3
1
4
1
5
9
2
6
5
3
5
8
9
7
9
3
2
3
8
4

563038556