A - Not Found

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

配点 : 100

問題文

英小文字からなる長さ 1 以上 25 以下の文字列 S が与えられます。
S に含まれない英小文字をひとつ出力してください。
但し、そのようなものが複数ある場合はどれを出力しても構いません。

制約

  • S は英小文字からなる長さ 1 以上 25 以下の文字列

入力

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

S

出力

S に含まれない英小文字をひとつ出力せよ。そのようなものが複数ある場合はどれを出力しても構わない。


入力例 1

a

出力例 1

d

S= a です。
a 以外の英小文字、 b, c, ..., z が正解となります。


入力例 2

abcdfhijklmnopqrstuvwxyz

出力例 2

e

S 中に含まれない英小文字は eg です。


入力例 3

qazplwsxokmedcijnrfvuhbgt

出力例 3

y

Score : 100 points

Problem Statement

You are given a string S of length between 1 and 25 consisting of lowercase English letters.
Output one lowercase English letter that does not appear in S.
If there are multiple such letters, you may output any one of them.

Constraints

  • S is a string of length between 1 and 25 (inclusive) consisting of lowercase English letters.

Input

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

S

Output

Output one lowercase English letter that does not appear in S. If there are multiple such letters, you may output any one of them.


Sample Input 1

a

Sample Output 1

d

S= a.
Any lowercase English letter other than a (that is, b, c, …, or z) is a correct answer.


Sample Input 2

abcdfhijklmnopqrstuvwxyz

Sample Output 2

e

The lowercase English letters not included in S are e and g.


Sample Input 3

qazplwsxokmedcijnrfvuhbgt

Sample Output 3

y
B - Cyclic

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

配点 : 100

問題文

各桁が 1 以上 9 以下の整数である 3 桁の整数 N が与えられます。

N100 の位を a10 の位を b1 の位を c としたとき、b,c,a をこの順に並べた整数と c,a,b をこの順に並べた整数をそれぞれ出力してください。

制約

  • N は各桁が 1 以上 9 以下の整数である 3 桁の整数

入力

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

N

出力

b,c,a をこの順に並べた整数と c,a,b をこの順に並べた整数をこの順で空白区切りで出力せよ。


入力例 1

379

出力例 1

793 937

379100 の位は 310 の位は 71 の位は 9 です。よって、793937 をそれぞれ出力します。


入力例 2

919

出力例 2

199 991

919100 の位は 910 の位は 11 の位は 9 です。よって、199991 をそれぞれ出力します。

Score : 100 points

Problem Statement

You are given a three-digit integer N where each digit is an integer between 1 and 9, inclusive.

Let a, b, c be the hundreds, tens, ones digits of N, respectively. Print an integer formed by arranging b, c, a in this order, and an integer formed by arranging c, a, b in this order.

Constraints

  • N is a three-digit integer where each digit is an integer between 1 and 9, inclusive.

Input

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

N

Output

Print two integers separated by a space in the following order: an integer formed by arranging b, c, a in this order, and an integer formed by arranging c, a, b in this order.


Sample Input 1

379

Sample Output 1

793 937

The hundreds, tens, ones digits of 379 are 3, 7, 9, respectively, so print 793 and 937.


Sample Input 2

919

Sample Output 2

199 991

The hundreds, tens, ones digits of 919 are 9, 1, 9, respectively, so print 199 and 991.

C - 3^A

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

配点 : 200

問題文

正整数 M が与えられます。 以下の条件を全て満たす正整数 N と非負整数列 A=(A_1,A_2,\ldots,A_N) を一つ求めてください。

  • 1\le N\le 20
  • 0\le A_i\le 10 (1\le i\le N)
  • \displaystyle \sum_{i=1}^N 3^{A_i}=M

ただし、制約下では条件を満たす NA の組が必ず存在することが証明できます。

制約

  • 1\le M\le 10^5

入力

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

M

出力

以下の形式で条件を満たす NA を出力せよ。

N
A_1 A_2 \ldots A_N

なお、条件を満たす NA の組が複数存在する場合は、どれを出力しても正答となる。


入力例 1

6

出力例 1

2
1 1

N=2A=(1,1) とすると \displaystyle \sum_{i=1}^N 3^{A_i}=3+3=6 より全ての条件を満たします。

他に N=4A=(0,0,1,0) なども条件を満たします。


入力例 2

100

出力例 2

4
2 0 2 4

入力例 3

59048

出力例 3

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

1\le N\le 20 という制約に注意してください。

Score : 200 points

Problem Statement

You are given a positive integer M. Find a positive integer N and a sequence of non-negative integers A = (A_1, A_2, \ldots, A_N) that satisfy all of the following conditions:

  • 1 \le N \le 20
  • 0 \le A_i \le 10 (1 \le i \le N)
  • \displaystyle \sum_{i=1}^N 3^{A_i} = M

It can be proved that under the constraints, there always exists at least one such pair of N and A satisfying the conditions.

Constraints

  • 1 \le M \le 10^5

Input

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

M

Output

Print N and A satisfying the conditions in the following format:

N
A_1 A_2 \ldots A_N

If there are multiple valid pairs of N and A, any of them is acceptable.


Sample Input 1

6

Sample Output 1

2
1 1

For example, with N=2 and A=(1,1), we have \displaystyle \sum_{i=1}^N 3^{A_i} = 3+3=6, satisfying all conditions.

Another example is N=4 and A=(0,0,1,0), which also satisfies the conditions.


Sample Input 2

100

Sample Output 2

4
2 0 2 4

Sample Input 3

59048

Sample Output 3

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

Note the condition 1 \le N \le 20.

D - Cut .0

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

配点 : 150

問題文

実数 X が小数点以下第 3 位まで与えられます。

実数 X を以下の条件を満たすように出力してください。

  • 小数点以下の部分について、末尾に 0 を付けない
  • 末尾に過剰な小数点を付けない

制約

  • 0 \le X < 100
  • X は小数点以下第 3 位まで与えられる

入力

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

X

出力

答えを出力せよ。


入力例 1

1.012

出力例 1

1.012

1.012 はそのまま出力しても構いません。


入力例 2

12.340

出力例 2

12.34

12.340 を末尾に 0 を付けずに出力すると 12.34 となります。


入力例 3

99.900

出力例 3

99.9

99.900 を末尾に 0 を付けずに出力すると 99.9 となります。


入力例 4

0.000

出力例 4

0

0.000 を末尾に 0 や過剰な小数点を付けずに出力すると 0 となります。

Score : 150 points

Problem Statement

A real number X is given to the third decimal place.

Print the real number X under the following conditions.

  • The decimal part must not have trailing 0s.
  • There must not be an unnecessary trailing decimal point.

Constraints

  • 0 \le X < 100
  • X is given to the third decimal place.

Input

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

X

Output

Output the answer.


Sample Input 1

1.012

Sample Output 1

1.012

1.012 can be printed as it is.


Sample Input 2

12.340

Sample Output 2

12.34

Printing 12.340 without the trailing 0 results in 12.34.


Sample Input 3

99.900

Sample Output 3

99.9

Printing 99.900 without the trailing 0s results in 99.9.


Sample Input 4

0.000

Sample Output 4

0

Printing 0.000 without trailing 0s or an unnecessary decimal point results in 0.

E - Peak

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

配点 : 300

問題文

高橋くんは数直線上に N 個のプレゼントを置きました。そのうち i 個目のプレゼントは座標 A_i に置かれました。

あなたは数直線上の長さ M の半開区間 [x,x+M) を選び、そこに含まれるプレゼントを全て獲得します。
より詳しくは、以下の手順でプレゼントを獲得します。

  • まず、実数 x をひとつ選択する。
  • その後、プレゼントのうち置かれている座標が x \le A_i < x+M を満たすものを全て獲得する。

最大でいくつのプレゼントを獲得することができますか?

制約

  • 入力は全て整数
  • 1 \le N \le 3 \times 10^5
  • 1 \le M \le 10^9
  • 0 \le A_i \le 10^9

入力

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

N M
A_1 A_2 \dots A_N

出力

答えを整数として出力せよ。


入力例 1

8 6
2 3 5 7 11 13 17 19

出力例 1

4

例えば、半開区間 [1.5,7.5) を指定します。
このとき、座標 2,3,5,7 にある 4 つのプレゼントを全て獲得することができ、これが獲得可能な最大の個数です。


入力例 2

10 1
3 1 4 1 5 9 2 6 5 3

出力例 2

2

同一の座標に複数のプレゼントが置いてあることもあります。


入力例 3

10 998244353
100000007 0 1755647 998244353 495 1000000000 1755648 503 1755649 998244853

出力例 3

7

Score : 300 points

Problem Statement

Takahashi has placed N gifts on a number line. The i-th gift is placed at coordinate A_i.

You will choose a half-open interval [x,x+M) of length M on the number line and acquire all the gifts included in it.
More specifically, you acquire gifts according to the following procedure.

  • First, choose one real number x.
  • Then, acquire all the gifts whose coordinates satisfy x \le A_i < x+M.

What is the maximum number of gifts you can acquire?

Constraints

  • All input values are integers.
  • 1 \le N \le 3 \times 10^5
  • 1 \le M \le 10^9
  • 0 \le A_i \le 10^9

Input

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

N M
A_1 A_2 \dots A_N

Output

Print the answer as an integer.


Sample Input 1

8 6
2 3 5 7 11 13 17 19

Sample Output 1

4

For example, specify the half-open interval [1.5,7.5).
In this case, you can acquire the four gifts at coordinates 2,3,5,7, the maximum number of gifts that can be acquired.


Sample Input 2

10 1
3 1 4 1 5 9 2 6 5 3

Sample Output 2

2

There may be multiple gifts at the same coordinate.


Sample Input 3

10 998244353
100000007 0 1755647 998244353 495 1000000000 1755648 503 1755649 998244853

Sample Output 3

7