A - 455

実行時間制限: 2 sec / メモリ制限: 1024 MiB

配点 : 100 点

問題文

整数 A, B, C が与えられます。A \neq B かつ B = C であるならば Yes を、そうでないならば No を出力してください。

制約

  • 1 \leq A, B, C \leq 9
  • 入力される値はすべて整数

入力

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

A B C

出力

問題文中の指示に従って Yes, No のいずれかを出力せよ。


入力例 1

4 5 5

出力例 1

Yes

4 \neq 5 かつ 5 = 5 なので Yes を出力します。


入力例 2

1 3 7

出力例 2

No

1 \neq 3 ですが 3 = 7 ではないので No を出力します。


入力例 3

6 6 6

出力例 3

No

Score : 100 points

Problem Statement

You are given integers A, B, C. If A \neq B and B = C, output Yes; otherwise, output No.

Constraints

  • 1 \leq A, B, C \leq 9
  • All input values are integers.

Input

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

A B C

Output

Output Yes or No according to the instructions in the problem statement.


Sample Input 1

4 5 5

Sample Output 1

Yes

Since 4 \neq 5 and 5 = 5, output Yes.


Sample Input 2

1 3 7

Sample Output 2

No

Although 1 \neq 3, we don't have 3 = 7, so output No.


Sample Input 3

6 6 6

Sample Output 3

No
B - Is it rated?

実行時間制限: 2 sec / メモリ制限: 1024 MiB

配点 : 100 点

問題文

現在 AtCoder で開催されている AtCoder Regular Contest (ARC) には、Div. 1 と Div. 2 の 2 種類が存在します。 ARC Div. 1 では レーティング が 1600 以上 2999 以下の人が、ARC Div. 2 ではレーティングが 1200 以上 2399 以下の人がそれぞれ Rated 対象 となります。

正整数 R, X が与えられます。

レーティングが R の人は ARC Div. X において Rated 対象ですか?

制約

  • 1\leq R \leq 4229
  • 1\leq X \leq 2
  • 入力は全て整数

入力

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

R X

出力

レーティングが R の人が ARC Div. X において Rated 対象ならば Yes を、そうでないならば No を出力せよ。


入力例 1

2000 1

出力例 1

Yes

2000 は 1600 以上 2999 以下であるため、レーティングが 2000 の人は ARC Div. 1 において Rated 対象です。


入力例 2

1000 1

出力例 2

No

1000 は 1600 未満であるため、レーティングが 1000 の人は ARC Div. 1 において Rated 対象ではありません。


入力例 3

1500 2

出力例 3

Yes

1500 は 1200 以上 2399 以下であるため、レーティングが 1500 の人は ARC Div. 2 において Rated 対象です。


入力例 4

2800 2

出力例 4

No

2800 は 2399 より大きいため、レーティングが 2800 の人は ARC Div. 2 において Rated 対象ではありません。

Score : 100 points

Problem Statement

AtCoder Regular Contest (ARC) currently has two divisions: Div. 1 and Div. 2. In ARC Div. 1, participants whose rating is between 1600 and 2999, inclusive, are rated. In ARC Div. 2, participants whose rating is between 1200 and 2399, inclusive, are rated.

You are given positive integers R and X.

Determine whether a person with rating R is rated in ARC Div. X.

Constraints

  • 1 \le R \le 4229
  • 1 \le X \le 2
  • All input values are integers.

Input

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

R X

Output

If a person with rating R is rated in ARC Div. X, output Yes; otherwise, output No.


Sample Input 1

2000 1

Sample Output 1

Yes

Because 2000 lies between 1600 and 2999, a person with rating 2000 is rated in ARC Div. 1.


Sample Input 2

1000 1

Sample Output 2

No

Because 1000 is less than 1600, a person with rating 1000 is not rated in ARC Div. 1.


Sample Input 3

1500 2

Sample Output 3

Yes

Because 1500 lies between 1200 and 2399, a person with rating 1500 is rated in ARC Div. 2.


Sample Input 4

2800 2

Sample Output 4

No

Because 2800 exceeds 2399, a person with rating 2800 is not rated in ARC Div. 2.

C - Subscribers

実行時間制限: 2 sec / メモリ制限: 1024 MiB

配点 : 200 点

問題文

整数 N が与えられます。
以下の指示に従って N の近似値を出力してください。

  • N が 10^3-1 以下ならば、N をそのまま出力する。
  • N が 10^3 以上 10^4-1 以下ならば、N の一の位を切り捨てて出力する。
  • N が 10^4 以上 10^5-1 以下ならば、N の十の位以下を切り捨てて出力する。
  • N が 10^5 以上 10^6-1 以下ならば、N の百の位以下を切り捨てて出力する。
  • N が 10^6 以上 10^7-1 以下ならば、N の千の位以下を切り捨てて出力する。
  • N が 10^7 以上 10^8-1 以下ならば、N の一万の位以下を切り捨てて出力する。
  • N が 10^8 以上 10^9-1 以下ならば、N の十万の位以下を切り捨てて出力する。

制約

  • N は 0 以上 10^9-1 以下の整数

入力

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

N

出力

答えを出力せよ。


入力例 1

20230603

出力例 1

20200000

20230603 は 10^7 以上 10^8-1 以下です。
したがって、一万以下の位を切り捨てて 20200000 を出力します。


入力例 2

0

出力例 2

0

入力例 3

304

出力例 3

304

入力例 4

500600

出力例 4

500000

Score : 200 points

Problem Statement

You are given an integer N.
Print an approximation of N according to the following instructions.

  • If N is less than or equal to 10^3-1, print N as it is.
  • If N is between 10^3 and 10^4-1, inclusive, truncate the ones digit of N and print the result.
  • If N is between 10^4 and 10^5-1, inclusive, truncate the tens digit and all digits below it of N and print the result.
  • If N is between 10^5 and 10^6-1, inclusive, truncate the hundreds digit and all digits below it of N and print the result.
  • If N is between 10^6 and 10^7-1, inclusive, truncate the thousands digit and all digits below it of N and print the result.
  • If N is between 10^7 and 10^8-1, inclusive, truncate the ten-thousands digit and all digits below it of N and print the result.
  • If N is between 10^8 and 10^9-1, inclusive, truncate the hundred-thousands digit and all digits below it of N and print the result.

Constraints

  • N is an integer between 0 and 10^9-1, inclusive.

Input

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

N

Output

Print the answer.


Sample Input 1

20230603

Sample Output 1

20200000

20230603 is between 10^7 and 10^8-1 (inclusive).
Therefore, truncate the ten-thousands digit and all digits below it, and print 20200000.


Sample Input 2

0

Sample Output 2

0

Sample Input 3

304

Sample Output 3

304

Sample Input 4

500600

Sample Output 4

500000
D - Isolated Seats

実行時間制限: 2 sec / メモリ制限: 1024 MiB

配点 : 200 点

問題文

o と x からなる長さ N の文字列 S が与えられます。
N 個の椅子が左右一列に並んでおり、左から i 番目の椅子には、S の i 文字目が o ならば人が座っており、x ならば人は座っていません。
以下の条件をすべて満たす椅子は何個あるか求めてください。

  • 人が座っていない
  • 左に椅子が無い、または左の椅子に人が座っていない
  • 右に椅子が無い、または右の椅子に人が座っていない

制約

  • 1 \leq N \leq 100
  • N は整数
  • S は o と x からなる長さ N の文字列

入力

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

N  
S  

出力

答えを 1 行で出力せよ。


入力例 1

8
xxoxxxox

出力例 1

2

左から 1,5 番目の椅子のみが条件を満たします。


入力例 2

5
ooooo

出力例 2

0

入力例 3

1
x

出力例 3

1

Score : 200 points

Problem Statement

You are given a string S of length N consisting of o and x.
N chairs are arranged in a row from left to right. If the i-th character of S is o, a person is sitting in the i-th chair from the left; if it is x, no person is sitting there.
Find the number of chairs that satisfy all of the following conditions.

  • No person is sitting in it.
  • There is no chair to its left, or no person is sitting in the chair to its left.
  • There is no chair to its right, or no person is sitting in the chair to its right.

Constraints

  • 1 \leq N \leq 100
  • N is an integer.
  • 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

Output the answer in one line.


Sample Input 1

8
xxoxxxox

Sample Output 1

2

Only the first and fifth chairs from the left satisfy the conditions.


Sample Input 2

5
ooooo

Sample Output 2

0

Sample Input 3

1
x

Sample Output 3

1
E - Not All Covered

実行時間制限: 2 sec / メモリ制限: 1024 MiB

配点 : 300 点

問題文

AtCoder 王国には 1 から N まで番号がつけられた N 個の城壁があります。また、 M 個の砲台があります。

砲台 i は L_i 以上 R_i 以下の番号の城壁を守っています。

ある砲台を破壊すると、その砲台が守っていた城壁はその砲台により守られなくなります。

どの砲台にも守られていない城壁が存在する状態にするためには、最小で何個の砲台を破壊する必要がありますか?

制約

  • 1 \leq N \leq 10^6
  • 1 \leq M \leq 2 \times 10^5
  • 1 \leq L_i \leq R_i \leq N (1 \leq i \leq M)
  • 入力はすべて整数

入力

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

N M
L_1 R_1
L_2 R_2
 \vdots 
L_M R_M

出力

砲台に守られていない城壁が存在する状態にするために破壊する必要がある砲台の個数の最小値を出力せよ。


入力例 1

10 4
1 6
4 5
5 10
7 10

出力例 1

1

砲台 1 を破壊するとどの砲台も城壁 3 を守っていない状態になります。 また、砲台を 1 個も破壊しなければ全ての城壁がどれかの砲台に守られている状態になります。 そのため、1 を出力します。


入力例 2

5 2
1 2
3 4

出力例 2

0

どの砲台も城壁 5 を守っていないため、砲台を 1 個も破壊しないでも砲台に守られていない城壁が存在する状態になります。そのため、0 を出力します。


入力例 3

5 10
2 5
1 5
1 2
2 4
2 2
5 5
2 4
1 2
2 2
2 3

出力例 3

3

Score : 300 points

Problem Statement

In the AtCoder Kingdom, there are N castle walls numbered from 1 through N. There are also M turrets.

Turret i guards castle walls numbered from L_i through R_i.

When a turret is destroyed, the castle walls that were guarded by that turret are no longer guarded by that turret.

What is the minimum number of turrets that need to be destroyed so that at least one castle wall is not guarded by any turret?

Constraints

  • 1 \leq N \leq 10^6
  • 1 \leq M \leq 2 \times 10^5
  • 1 \leq L_i \leq R_i \leq N (1 \leq i \leq M)
  • All input values are integers.

Input

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

N M
L_1 R_1
L_2 R_2
 \vdots 
L_M R_M

Output

Output the minimum number of turrets that need to be destroyed so that at least one castle wall is not guarded by any turret.


Sample Input 1

10 4
1 6
4 5
5 10
7 10

Sample Output 1

1

If turret 1 is destroyed, no turret guards castle wall 3. Also, if no turrets are destroyed, all castle walls are guarded by some turret. Therefore, output 1.


Sample Input 2

5 2
1 2
3 4

Sample Output 2

0

Since no turret guards castle wall 5, there already exists a castle wall not guarded by any turret without destroying any turrets. Therefore, output 0.


Sample Input 3

5 10
2 5
1 5
1 2
2 4
2 2
5 5
2 4
1 2
2 2
2 3

Sample Output 3

3