実行時間制限: 2 sec / メモリ制限: 1024 MiB
配点 : 100 点
問題文
AtCoder 王国では、競技プログラミングの実力を測る検定試験が実施されています。
試験は 100 点満点であり、点数が高ければ高いほど、高いランクが認定されます。
ランクは以下のように定められています。
- 0 点以上 40 点未満のとき、初級
- 40 点以上 70 点未満のとき、中級
- 70 点以上 90 点未満のとき、上級
- 90 点以上のとき、エキスパート
高橋君は、この検定試験を受験し、X 点を取りました。
高橋君が認定されたランクより一つ高いランクとなるためには最低であと何点必要か求めてください。ただし、高橋君がエキスパートと認定された場合、それより高いランクは存在しないため expert と出力してください。
制約
- 0 \leq X \leq 100
- X は整数
入力
入力は以下の形式で標準入力から与えられる。
X
出力
答えを出力せよ。
入力例 1
56
出力例 1
14
高橋君は 56 点を取り、中級と認定されました。一つ高いランクである上級となるためには、最低であと 14 点必要です。
入力例 2
32
出力例 2
8
入力例 3
0
出力例 3
40
入力例 4
100
出力例 4
expert
高橋君は満点を取り、エキスパートと認定されました。これより高いランクは存在しないため、expert と出力します。
Score : 100 points
Problem Statement
In the Kingdom of AtCoder, there is a standardized test of competitive programming proficiency.
An examinee will get a score out of 100 and obtain a rank according to the score, as follows:
- Novice, for a score not less than 0 but less than 40;
- Intermediate, for a score not less than 40 but less than 70;
- Advanced, for a score not less than 70 but less than 90;
- Expert, for a score not less than 90.
Takahashi took this test and got X points.
Find the minimum number of extra points needed to go up one rank higher. If, however, his rank was Expert, print expert, as there is no higher rank than that.
Constraints
- 0 \leq X \leq 100
- X is an integer.
Input
Input is given from Standard Input in the following format:
X
Output
Print the answer.
Sample Input 1
56
Sample Output 1
14
He got 56 points and was certified as Intermediate. In order to reach the next rank of Advanced, he needs at least 14 more points.
Sample Input 2
32
Sample Output 2
8
Sample Input 3
0
Sample Output 3
40
Sample Input 4
100
Sample Output 4
expert
He got full points and was certified as Expert. There is no rank higher than that, so print expert.
実行時間制限: 2 sec / メモリ制限: 1024 MiB
配点 : 100 点
問題文
以下の式で計算される値を \mathrm{BMI}[\mathrm{kg}/\mathrm{m}^2] と言います。
- \text{体重}[\mathrm{kg}] \div \text{身長}[\mathrm{m}] \div \text{身長}[\mathrm{m}]
日本では、\mathrm{BMI} が 25 \; \mathrm{kg}/\mathrm{m}^2 以上の人は肥満とされます。
身長 H[\mathrm{cm}]、体重 W[\mathrm{kg}] の人が日本で肥満とされるかどうかを判定してください。
制約
- 1 \leq H \leq 300
- 1 \leq W \leq 300
- 入力される値はすべて整数
入力
入力は以下の形式で標準入力から与えられる。
H W
出力
身長 H[\mathrm{cm}]、体重 W[\mathrm{kg}] の人が日本で肥満とされるならば Yes を、そうでないならば No を 1 行で出力せよ。
入力例 1
180 60
出力例 1
No
身長が 180 \; \mathrm{cm}=1.8 \; \mathrm{m} なので、\mathrm{BMI} は 60 \; \mathrm{kg} \div 1.8 \; \mathrm{m} \div 1.8 \; \mathrm{m}=18.5\dots \; \mathrm{kg}/\mathrm{m}^2 となり、この人は肥満とはされません。
入力例 2
182 188
出力例 2
Yes
入力例 3
180 81
出力例 3
Yes
Score : 100 points
Problem Statement
The value calculated by the following formula is called \mathrm{BMI}[\mathrm{kg}/\mathrm{m}^2]. (\div denotes division.)
- \text{Weight}[\mathrm{kg}] \div \text{Height}[\mathrm{m}] \div \text{Height}[\mathrm{m}]
In Japan, a person whose \mathrm{BMI} is 25 \; \mathrm{kg}/\mathrm{m}^2 or more is considered obese.
Determine whether a person with height H[\mathrm{cm}] and weight W[\mathrm{kg}] is considered obese in Japan.
Constraints
- 1 \leq H \leq 300
- 1 \leq W \leq 300
- All input values are integers.
Input
The input is given from Standard Input in the following format:
H W
Output
Output Yes on one line if a person with height H[\mathrm{cm}] and weight W[\mathrm{kg}] is considered obese in Japan, and No otherwise.
Sample Input 1
180 60
Sample Output 1
No
Since the height is 180 \; \mathrm{cm}=1.8 \; \mathrm{m}, the \mathrm{BMI} is 60 \; \mathrm{kg} \div 1.8 \; \mathrm{m} \div 1.8 \; \mathrm{m}=18.5\dots \; \mathrm{kg}/\mathrm{m}^2, so this person is not considered obese.
Sample Input 2
182 188
Sample Output 2
Yes
Sample Input 3
180 81
Sample Output 3
Yes
実行時間制限: 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.
実行時間制限: 2 sec / メモリ制限: 1024 MiB
配点 : 200 点
問題文
N 個のボールがあります。各ボールは色 1 から色 N までの N 色のいずれかで塗られており、i 個目 (1\le i\le N) のボールの色は C_i です。
あなたは 1 回の操作で好きなボール 1 つを好きな N 色のいずれかに変更することができます。
全てのボールが同じ色になるようにするためには、最小で何回の操作が必要か求めてください。
制約
- 1\le N\le 100
- 1\le C_i\le N
- 入力される値は全て整数
入力
入力は以下の形式で標準入力から与えられる。
N C_1 C_2 \ldots C_N
出力
答えを出力せよ。
入力例 1
4 3 1 2 1
出力例 1
2
1 個目のボールの色を 1 に、3 個目のボールの色を 1 にすることで全てのボールの色を同じ色にすることができます。
2 個未満のボールの色を変えることで全てのボールの色を同じ色にすることはできないので、2 を出力してください。
入力例 2
5 3 3 3 3 3
出力例 2
0
最初から全てのボールの色が同じ場合もあります。
入力例 3
9 4 2 3 3 4 1 2 7 1
出力例 3
7
Score : 200 points
Problem Statement
There are N balls. Each ball is painted in one of N colors: color 1 through color N. The color of the i-th ball (1\le i\le N) is C_i.
In one operation, you can change the color of any one ball to any of the N colors.
Find the minimum number of operations required to make all the balls the same color.
Constraints
- 1\le N\le 100
- 1\le C_i\le N
- All input values are integers.
Input
The input is given from Standard Input in the following format:
N C_1 C_2 \ldots C_N
Output
Output the answer.
Sample Input 1
4 3 1 2 1
Sample Output 1
2
By changing the color of the first ball to 1 and the color of the third ball to 1, you can make all the balls the same color.
It is impossible to make all the balls the same color by changing the colors of fewer than two balls, so output 2.
Sample Input 2
5 3 3 3 3 3
Sample Output 2
0
All balls may have the same color from the beginning.
Sample Input 3
9 4 2 3 3 4 1 2 7 1
Sample Output 3
7
実行時間制限: 2 sec / メモリ制限: 1024 MiB
配点 : 300 点
問題文
寿司の材料として、N 個のシャリと M 個のネタがあります。
i 番目のシャリの重さは A_i、j 番目のネタの重さは B_j です。
あなたは、シャリとネタを組み合わせることで寿司を作ろうとしています。
寿司を 1 つ作るためには、1 つのシャリと 1 つのネタを組み合わせる必要があります。ただし、ネタの重さはシャリの重さの 2 倍以下でなければなりません。また、1 つのシャリやネタを複数の寿司に使うことはできません。
作ることのできる寿司の個数の最大値を求めてください。
制約
- 1 \leq N, M \leq 2 \times 10^5
- 1 \leq A_i, B_j \leq 10^9
- 入力される値はすべて整数
入力
入力は以下の形式で標準入力から与えられる。
N M A_1 A_2 \ldots A_N B_1 B_2 \ldots B_M
出力
答えを出力せよ。
入力例 1
4 5 4 2 1 8 14 9 3 2 9
出力例 1
3
1 番目のシャリと 3 番目のネタ、2 番目のシャリと 4 番目のネタ、4 番目のシャリと 1 番目のネタを組み合わせるなどの方法で 3 つの寿司を作ることができます。4 つ以上の寿司を作ることはできないため、3 を出力します。
入力例 2
3 3 5 5 3 11 1000 1000
出力例 2
0
入力例 3
8 7 2 3 4 4 4 3 2 3 8 5 5 9 9 7 1
出力例 3
5
Score : 300 points
Problem Statement
There are N pieces of shari (vinegared rice) and M pieces of neta (toppings) as ingredients for sushi.
The weight of the i-th shari is A_i, and the weight of the j-th neta is B_j.
You will make sushi by combining shari and neta.
To make one piece of sushi, you need to combine one shari with one neta. Here, the weight of the neta must be at most twice the weight of the shari. Also, the same shari or neta cannot be used in multiple pieces of sushi.
Find the maximum number of sushi that can be made.
Constraints
- 1 \leq N, M \leq 2 \times 10^5
- 1 \leq A_i, B_j \leq 10^9
- All input values are integers.
Input
The input is given from Standard Input in the following format:
N M A_1 A_2 \ldots A_N B_1 B_2 \ldots B_M
Output
Output the answer.
Sample Input 1
4 5 4 2 1 8 14 9 3 2 9
Sample Output 1
3
By combining the 1st shari with the 3rd neta, the 2nd shari with the 4th neta, and the 4th shari with the 1st neta, for example, you can make three pieces of sushi. It is impossible to make four or more pieces of sushi, so output 3.
Sample Input 2
3 3 5 5 3 11 1000 1000
Sample Output 2
0
Sample Input 3
8 7 2 3 4 4 4 3 2 3 8 5 5 9 9 7 1
Sample Output 3
5