Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 100 点
問題文
長さ N の英小文字からなる文字列 S が与えられます。
S の i 文字目を S_i と記します。
S_1,S_1,S_2,S_2,\dots,S_N,S_N をこの順に連結した長さ 2N の文字列を出力してください。
例えば、 S が beginner のときは bbeeggiinnnneerr と出力してください。
制約
- N は 1 \le N \le 50 を満たす整数
- S は長さ N の英小文字からなる文字列
入力
入力は以下の形式で標準入力から与えられる。
N S
出力
答えを出力せよ。
入力例 1
8 beginner
出力例 1
bbeeggiinnnneerr
問題文中の例と同じです。
入力例 2
3 aaa
出力例 2
aaaaaa
Score : 100 points
Problem Statement
You are given a string S of length N consisting of lowercase English letters.
We denote the i-th character of S by S_i.
Print the string of length 2N obtained by concatenating S_1,S_1,S_2,S_2,\dots,S_N, and S_N in this order.
For example, if S is beginner, print bbeeggiinnnneerr.
Constraints
- N is an integer such that 1 \le N \le 50.
- S is a string of length N consisting of lowercase English letters.
Input
The input is given from Standard Input in the following format:
N S
Output
Print the answer.
Sample Input 1
8 beginner
Sample Output 1
bbeeggiinnnneerr
It is the same as the example described in the problem statement.
Sample Input 2
3 aaa
Sample Output 2
aaaaaa
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 100 点
問題文
実数 X.Y が与えられます。ただし Y はちょうど 1 桁です。
- 0 \leq Y \leq 2 ならば、X-
- 3 \leq Y \leq 6 ならば、X
- 7 \leq Y \leq 9 ならば、X+
と出力してください。
制約
- 1 \leq X \leq 15
- 0 \leq Y \leq 9
- X と Y は整数
入力
入力は以下の形式で標準入力から与えられる。
X.Y
出力
答えを出力せよ。
入力例 1
15.8
出力例 1
15+
15 + のような出力は不正解とみなされます。
X と + の間や、X と - の間には空白を入れずに出力してください。
入力例 2
1.0
出力例 2
1-
1.00 や 1 などの値が入力として与えられることはありません。
入力例 3
12.5
出力例 3
12
Score : 100 points
Problem Statement
You are given a real number X.Y, where Y is a single digit.
Print the following: (quotes for clarity)
- X-, if 0 \leq Y \leq 2;
- X, if 3 \leq Y \leq 6;
- X+, if 7 \leq Y \leq 9.
Constraints
- 1 \leq X \leq 15
- 0 \leq Y \leq 9
- X and Y are integers.
Input
Input is given from Standard Input in the following format:
X.Y
Output
Print the answer.
Sample Input 1
15.8
Sample Output 1
15+
Here, printing 15 + will not be accepted: do not print a space between X and +, or between X and -.
Sample Input 2
1.0
Sample Output 2
1-
You will not get inputs such as 1.00 and 1.
Sample Input 3
12.5
Sample Output 3
12
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 200 点
問題文
以下の図で表される正五角形 P があります。

P の点 S_1 と点 S_2 を結ぶ線分と、点 T_1 と点 T_2 を結ぶ線分の長さが等しいか判定してください。
制約
- S_1,S_2,T_1,T_2 は
A,B,C,D,Eのいずれかの文字 - S_1 \neq S_2
- T_1 \neq T_2
入力
入力は以下の形式で標準入力から与えられる。
S_1S_2 T_1T_2
出力
P の点 S_1 と点 S_2 を結ぶ線分と、点 T_1 と点 T_2 を結ぶ線分の長さが等しい場合 Yes を、等しくない場合 No を出力せよ。
入力例 1
AC EC
出力例 1
Yes
P の点 A と点 C を結ぶ線分と、P の点 E と点 C を結ぶ線分の長さは等しいです。
入力例 2
DA EA
出力例 2
No
P の点 D と点 A を結ぶ線分と、P の点 E と点 A を結ぶ線分の長さは等しくありません。
入力例 3
BD BD
出力例 3
Yes
Score : 200 points
Problem Statement
A regular pentagon P is shown in the figure below.

Determine whether the length of the line segment connecting points S_1 and S_2 of P equals the length of the line segment connecting points T_1 and T_2.
Constraints
- Each of S_1, S_2, T_1, and T_2 is one of the characters
A,B,C,D, andE. - S_1 \neq S_2
- T_1 \neq T_2
Input
The input is given from Standard Input in the following format:
S_1S_2 T_1T_2
Output
If the length of the line segment connecting points S_1 and S_2 of P equals the length of the line segment connecting points T_1 and T_2, print Yes; otherwise, print No.
Sample Input 1
AC EC
Sample Output 1
Yes
The length of the line segment connecting point A and point C of P equals the length of the line segment connecting point E and point C.
Sample Input 2
DA EA
Sample Output 2
No
The length of the line segment connecting point D and point A of P does not equal the length of the line segment connecting point E and point A.
Sample Input 3
BD BD
Sample Output 3
Yes
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 200 点
問題文
正整数 A,B が与えられます。
A+B を(十進法で)計算する時、繰り上がりが生じないなら Easy 、生じるなら Hard と出力してください。
制約
- A,B は整数
- 1 \le A,B \le 10^{18}
入力
入力は以下の形式で標準入力から与えられる。
A B
出力
繰り上がりが生じないなら Easy 、生じるなら Hard と出力せよ。
入力例 1
229 390
出力例 1
Hard
229+390 を計算する際、十の位から百の位へと繰り上がりが発生します。よって、答えは Hard です。
入力例 2
123456789 9876543210
出力例 2
Easy
繰り上がりは発生しません。答えは Easy です。
また、入力が 32bit 整数に収まらないこともあります。
Score : 200 points
Problem Statement
You are given positive integers A and B.
Let us calculate A+B (in decimal). If it does not involve a carry, print Easy; if it does, print Hard.
Constraints
- A and B are integers.
- 1 \le A,B \le 10^{18}
Input
Input is given from Standard Input in the following format:
A B
Output
If the calculation does not involve a carry, print Easy; if it does, print Hard.
Sample Input 1
229 390
Sample Output 1
Hard
When calculating 229+390, we have a carry from the tens digit to the hundreds digit, so the answer is Hard.
Sample Input 2
123456789 9876543210
Sample Output 2
Easy
We do not have a carry here; the answer is Easy.
Note that the input may not fit into a 32-bit integer.
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 300 点
問題文
1 から N の番号が付いた N 人がコイントスを何回かしました。人 i は A_i 回表を出し、B_i 回裏を出したこと分かっています。
人 i のコイントスの 成功率 は \displaystyle\frac{A_i}{A_i+B_i} で定義されます。人 1,\ldots,N の番号を、成功率の高い順に並び替えてください。成功率が同じ人が複数いる場合、その中では人の番号が小さい順になるように並び替えてください。
制約
- 2\leq N \leq 2\times 10^5
- 0\leq A_i, B_i\leq 10^9
- A_i+B_i \geq 1
- 入力される数値は全て整数
入力
入力は以下の形式で標準入力から与えられる。
N A_1 B_1 \vdots A_N B_N
出力
人 1,\ldots,N の番号を成功率の高い順に空白区切りで出力せよ。成功率が同じ人の番号は昇順に並び替えて出力せよ。
入力例 1
3 1 3 3 1 2 2
出力例 1
2 3 1
人 1 の成功率は 0.25、人 2 の成功率は 0.75、人 3 の成功率は 0.5 です。
成功率の高い順に並び替えると出力例の順番になります。
入力例 2
2 1 3 2 6
出力例 2
1 2
人 1,2 は成功率が同じなので、番号の昇順に出力することに注意してください。
入力例 3
4 999999999 1000000000 333333333 999999999 1000000000 999999997 999999998 1000000000
出力例 3
3 1 4 2
Score : 300 points
Problem Statement
N people numbered 1 through N tossed a coin several times. We know that person i's tosses resulted in A_i heads and B_i tails.
Person i's success rate of the tosses is defined by \displaystyle\frac{A_i}{A_i+B_i}. Sort people 1,\ldots,N in descending order of their success rates, with ties broken in ascending order of their assigned numbers.
Constraints
- 2\leq N \leq 2\times 10^5
- 0\leq A_i, B_i\leq 10^9
- A_i+B_i \geq 1
- All input values are integers.
Input
The input is given from Standard Input in the following format:
N A_1 B_1 \vdots A_N B_N
Output
Print the numbers of people 1,\ldots,N in descending order of their success rates, with ties broken in ascending order of their assigned numbers.
Sample Input 1
3 1 3 3 1 2 2
Sample Output 1
2 3 1
Person 1's success rate is 0.25, person 2's is 0.75, and person 3's is 0.5.
Sort them in descending order of their success rates to obtain the order in Sample Output.
Sample Input 2
2 1 3 2 6
Sample Output 2
1 2
Note that person 1 and 2 should be printed in ascending order of their numbers, as they have the same success rates.
Sample Input 3
4 999999999 1000000000 333333333 999999999 1000000000 999999997 999999998 1000000000
Sample Output 3
3 1 4 2