A - Candy Cookie Law

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

配点 : 100

問題文

高橋君の住む AtCoder 国には「飴を A 個以上所持している人はクッキーを B 個以上所持していなければならない」という奇妙な法律があります。

高橋君は飴を C 個、クッキーを D 個所持しています。高橋君がこの法律に違反しているかどうか判定してください。

制約

  • 1\leq A,B,C,D \leq 100
  • 入力は全て整数

入力

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

A B C D

出力

高橋君が法律に違反しているとき Yes、違反していないとき No と出力せよ。


入力例 1

10 20 30 40

出力例 1

No

AtCoder国には「飴を 10 個以上所持している人はクッキーを 20 個以上所持していなければならない」という法律があります。

高橋君は飴を 30 個、クッキーを 40 個所持しているため、この法律に違反していません。


入力例 2

10 20 30 4

出力例 2

Yes

入力例 3

100 100 1 1

出力例 3

No

Score : 100 points

Problem Statement

In AtCoder Country where Takahashi lives, there is a strange law that "a person who possesses A or more candies must possess B or more cookies."

Takahashi possesses C candies and D cookies. Determine whether Takahashi is violating this law.

Constraints

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

Input

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

A B C D

Output

Print Yes if Takahashi is violating the law, and No otherwise.


Sample Input 1

10 20 30 40

Sample Output 1

No

In AtCoder Country, there is a law that "a person who possesses 10 or more candies must possess 20 or more cookies."

Takahashi possesses 30 candies and 40 cookies, so he is not violating this law.


Sample Input 2

10 20 30 4

Sample Output 2

Yes

Sample Input 3

100 100 1 1

Sample Output 3

No
B - Exact Price

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

配点 : 100

問題文

高橋君の財布の中には 100 円硬貨が 1 枚以上入っており、それ以外には何も入っていません。

高橋君の財布の中の合計金額が X 円である可能性はありますか?

制約

  • 0 \leq X \leq 1000
  • 入力は全て整数

入力

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

X

出力

高橋君の財布の中の合計金額が X 円である可能性がある場合は Yes、そうでない場合は No と出力せよ。


入力例 1

500

出力例 1

Yes

財布に 100 円硬貨が 5 枚入っているとき、合計金額は 500 円になります。故に財布の中の合計金額は X=500 円になりうるため、Yes を出力します。


入力例 2

40

出力例 2

No

入力例 3

0

出力例 3

No

財布の中には 100 円硬貨が 1 枚以上入っていることに注意してください。

Score : 100 points

Problem Statement

Takahashi's purse has one or more 100-yen coins in it and nothing else. (Yen is the Japanese currency.)

Is it possible that the total amount of money in the purse is X yen?

Constraints

  • 0 \leq X \leq 1000
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

X

Output

If it is possible that the total amount of money in Takahashi's purse is X yen, print Yes; otherwise, print No.


Sample Input 1

500

Sample Output 1

Yes

If the purse has five 100-yen coins, the total amount of money is 500 yen. Thus, it is possible that the total amount is X=500 yen, so we should print Yes.


Sample Input 2

40

Sample Output 2

No

Sample Input 3

0

Sample Output 3

No

Note that the purse has at least one 100-yen coin.

C - 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.

D - Nearest Taller

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

配点 : 200

問題文

N 人の人が左右一列に並んでいます。左から i 番目 (1\le i\le N) の人を人 i と呼びます。人 i (1\le i\le N) の身長は A_i です。

i=1,2,\ldots,N に対し、人 i より左にいる人であって人 i より身長の高い人が存在するか判定し、存在する場合はその中で番号が人 i に最も近い人を求めてください。

制約

  • 1\le N\le 100
  • 1\le A_i\le 100
  • 入力される値は全て整数

入力

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

N
A_1 A_2 \ldots A_N

出力

N 行出力せよ。

i 行目 (1\le i\le N) には、人 i より左にいる人であって人 i より身長の高い人が存在しない場合は -1 を、存在する場合はその中で番号が人 i に最も近い人の番号を出力せよ。


入力例 1

4
4 3 2 5

出力例 1

-1
1
2
-1
  • 1 より左側に人はいません。したがって、 1 行目には -1 を出力してください。
  • 2 より左側にいる人で人 2 より身長が高いのは人 1 のみです。したがって、 2 行目には 1 を出力してください。
  • 3 より左側にいる人で人 3 より身長が高いのは人 1,2 で、このうち番号が人 3 に最も近いのは人 2 です。したがって、 3 行目には 2 を出力してください。
  • 4 より左側に人 4 より身長が高い人はいません。したがって、 4 行目には -1 を出力してください。

入力例 2

3
7 7 7

出力例 2

-1
-1
-1

同じ身長の人が複数人いる場合もあります。


入力例 3

6
31 9 17 10 2 9

出力例 3

-1
1
1
3
4
4

Score : 200 points

Problem Statement

There are N people standing in a row from left to right. The i-th person from the left (1\le i\le N) is called person i. The height of person i (1\le i\le N) is A_i.

For each i=1,2,\ldots,N, determine whether there exists a person to the left of person i who is taller than person i, and if so, find the person standing closest to person i among them.

Constraints

  • 1\le N\le 100
  • 1\le A_i\le 100
  • All input values are integers.

Input

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

N
A_1 A_2 \ldots A_N

Output

Output N lines.

The i-th line (1\le i\le N) should contain -1 if there is no person to the left of person i who is taller than person i, and otherwise, the number representing the person standing closest to person i among such people.


Sample Input 1

4
4 3 2 5

Sample Output 1

-1
1
2
-1
  • There is no person to the left of person 1. Thus, output -1 on the first line.
  • Among the people to the left of person 2, only person 1 is taller than person 2. Thus, output 1 on the second line.
  • Among the people to the left of person 3, persons 1,2 are taller than person 3, and the person standing closest to person 3 is person 2. Thus, output 2 on the third line.
  • There is no person to the left of person 4 who is taller than person 4. Thus, output -1 on the fourth line.

Sample Input 2

3
7 7 7

Sample Output 2

-1
-1
-1

There may be multiple people with the same height.


Sample Input 3

6
31 9 17 10 2 9

Sample Output 3

-1
1
1
3
4
4
E - Snake Numbers

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

配点 : 350

問題文

10 以上の正整数のうち、十進数表記したときに先頭の桁(最も大きい位)の数字がそれ以外のどの桁の数字よりも真に大きくなるようなものを ヘビ数 とよびます。 例えば、31201 はヘビ数ですが、35202 はヘビ数ではありません。

L 以上 R 以下のヘビ数が何個あるか求めてください。

制約

  • 10\leq L \leq R \leq 10^{18}
  • 入力は全て整数

入力

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

L R

出力

答えを出力せよ。


入力例 1

97 210

出力例 1

6

97 以上 210 以下のヘビ数は、97,98,100,200,201,2106 個です。


入力例 2

1000 9999

出力例 2

2025

入力例 3

252509054433933519 760713016476190692

出力例 3

221852052834757

Score : 350 points

Problem Statement

A positive integer not less than 10 whose top digit (the most significant digit) in decimal representation is strictly larger than every other digit in that number is called a Snake number. For example, 31 and 201 are Snake numbers, but 35 and 202 are not.

Find how many Snake numbers exist between L and R, inclusive.

Constraints

  • 10 \leq L \leq R \leq 10^{18}
  • All input values are integers.

Input

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

L R

Output

Print the answer.


Sample Input 1

97 210

Sample Output 1

6

The Snake numbers between 97 and 210, inclusive, are 97, 98, 100, 200, 201, and 210: there are six.


Sample Input 2

1000 9999

Sample Output 2

2025

Sample Input 3

252509054433933519 760713016476190692

Sample Output 3

221852052834757