Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 100 点
問題文
N が与えられます。2^N を出力してください。
制約
- 0 \leq N \leq 30
- N は整数である
入力
入力は以下の形式で標準入力から与えられる。
N
出力
答えを出力せよ。
入力例 1
3
出力例 1
8
2^3=8 です。
入力例 2
30
出力例 2
1073741824
Score : 100 points
Problem Statement
Given N, print 2^N.
Constraints
- 0 \leq N \leq 30
- N is an integer.
Input
Input is given from Standard Input in the following format:
N
Output
Print the answer.
Sample Input 1
3
Sample Output 1
8
We have 2^3=8.
Sample Input 2
30
Sample Output 2
1073741824
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 100 点
問題文
高橋君は、AtCoder 語を勉強しています。
高橋君は英単語に対して AtCoder 語の単語を対応させて覚えています。
高橋君は英語における red, blue, green は AtCoder 語ではそれぞれ SSS, FFF, MMM に対応していることを覚えており、他の単語は覚えていません。
英小文字からなる文字列 S が与えられます。S が高橋君が AtCoder 語との対応を覚えている英単語の表記と一致しているならば S に対応している AtCoder 語の単語を、そうでないならば文字列 Unknown を出力してください。
制約
- S は長さ 1 以上 10 以下の英小文字からなる文字列
入力
入力は以下の形式で標準入力から与えられる。
S
出力
問題文中の指示に従い、文字列を出力せよ。
入力例 1
red
出力例 1
SSS
英語における red は AtCoder 語における SSS に対応します。
入力例 2
atcoder
出力例 2
Unknown
Score : 100 points
Problem Statement
Takahashi is learning AtCoderish Language.
He memorizes AtCoderish words corresponding to English words.
He knows that red, blue, and green in English respectively correspond to SSS, FFF, and MMM in AtCoderish, and he knows no other words.
You are given a string S consisting of lowercase English letters. If S equals an English word that Takahashi knows corresponds to an AtCoderish word, output the AtCoderish word corresponding to S; otherwise, output the string Unknown.
Constraints
- S is a string of length between 1 and 10, inclusive, consisting of English letters.
Input
The input is given from Standard Input in the following format:
S
Output
Output a string according to the instructions in the problem statement.
Sample Input 1
red
Sample Output 1
SSS
red in English corresponds to SSS in AtCoderish.
Sample Input 2
atcoder
Sample Output 2
Unknown
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 200 点
問題文
1 から N の番号がついた N 人の人がいます。
人 i はキーエンス本社ビルの建築面積を S_i 平方メートルであると予想しました。
キーエンス本社ビルは下図のような形をしています。ただし、a,b はある 正の整数 です。
つまり、キーエンス本社ビルの建築面積は 4ab+3a+3b 平方メートルと表されます。
N 人のうち、この情報のみによって、予想した面積が確実に誤りであるとわかる人数を求めてください。

制約
- 1 \leq N \leq 20
- 1 \leq S_i \leq 1000
- 入力に含まれる値は全て整数である
入力
入力は以下の形式で標準入力から与えられる。
N S_1 \ldots S_N
出力
答えを出力せよ。
入力例 1
3 10 20 39
出力例 1
1
a=1,b=1 のとき面積は 10 平方メートル、a=2,b=3 のとき面積は 39 平方メートルとなります。
しかし a,b がどのような正の整数であったとしても面積が 20 平方メートルになることはありません。
よって、人 2 の予想だけは確実に誤りであることがわかります。
入力例 2
5 666 777 888 777 666
出力例 2
3
Score : 200 points
Problem Statement
There are N people numbered 1 to N.
Person i guessed the building area of KEYENCE headquarters building to be S_i square meters.
The shape of KEYENCE headquarters building is shown below, where a and b are some positive integers.
That is, the building area of the building can be represented as 4ab+3a+3b.
Based on just this information, how many of the N people are guaranteed to be wrong in their guesses?

Constraints
- 1 \leq N \leq 20
- 1 \leq S_i \leq 1000
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
N S_1 \ldots S_N
Output
Print the answer.
Sample Input 1
3 10 20 39
Sample Output 1
1
The area would be 10 square meters if a=1,b=1, and 39 square meters if a=2,b=3.
However, no pair of positive integers a and b would make the area 20 square meters.
Thus, we can only be sure that Person 2 guessed wrong.
Sample Input 2
5 666 777 888 777 666
Sample Output 2
3
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 200 点
問題文
正整数 N が与えられるので、下記で定まる長さ (N+1) の文字列 s_0s_1\ldots s_N を出力してください。
各 i = 0, 1, 2, \ldots, N について、
- 1 以上 9 以下の N の約数 j であって、i が N/j の倍数であるものが存在するとき、そのような j のうち最小のものに対応する数字を s_i とする。(よって、この場合 s_i は
1、2、\ldots 、9のいずれかである。)- そのような j が存在しないとき、s_i は
-とする。
制約
- 1 \leq N \leq 1000
- 入力はすべて整数
入力
入力は以下の形式で標準入力から与えられる。
N
出力
答えを出力せよ。
入力例 1
12
出力例 1
1-643-2-346-1
以下で、いくつかの i について s_i の決め方を説明します。
-
i = 0 について、1 以上 9 以下の N の約数 j であって i が N/j の倍数であるものは、j = 1, 2, 3, 4, 6 の 5 個です。そのうち最小のものは 1 であるので、s_0 =
1です。 -
i = 4 について、1 以上 9 以下の N の約数 j であって i が N/j の倍数であるものは、j = 3, 6 の 2 個です。そのうち最小のものは 3 であるので、s_4 =
3です。 -
i = 11 について、1 以上 9 以下の N の約数 j であって i が N/j の倍数であるものは存在しないので、s_{11} =
-です。
入力例 2
7
出力例 2
17777771
入力例 3
1
出力例 3
11
Score : 200 points
Problem Statement
You are given a positive integer N. Print a string of length (N+1), s_0s_1\ldots s_N, defined as follows.
For each i = 0, 1, 2, \ldots, N,
- if there is a divisor j of N that is between 1 and 9, inclusive, and i is a multiple of N/j, then s_i is the digit corresponding to the smallest such j (s_i will thus be one of
1,2, ...,9);- if no such j exists, then s_i is
-.
Constraints
- 1 \leq N \leq 1000
- All input values are integers.
Input
The input is given from Standard Input in the following format:
N
Output
Print the answer.
Sample Input 1
12
Sample Output 1
1-643-2-346-1
We will explain how to determine s_i for some i.
-
For i = 0, the divisors j of N between 1 and 9 such that i is a multiple of N/j are 1, 2, 3, 4, 6. The smallest of these is 1, so s_0 =
1. -
For i = 4, the divisors j of N between 1 and 9 such that i is a multiple of N/j are 3, 6. The smallest of these is 3, so s_4 =
3. -
For i = 11, there are no divisors j of N between 1 and 9 such that i is a multiple of N/j, so s_{11} =
-.
Sample Input 2
7
Sample Output 2
17777771
Sample Input 3
1
Sample Output 3
11
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 300 点
問題文
長さ N の非負整数列 A が与えられます。
A から K 要素を選んで順序を保ったまま抜き出した列を B としたとき、 MEX(B) としてありえる最大値を求めてください。
但し、数列 X に対して MEX(X) は以下の条件を満たす唯一の非負整数 m として定義されます。
- 0 \le i < m を満たす全ての整数 i が X に含まれる。
- m が X に含まれない。
制約
- 入力は全て整数
- 1 \le K \le N \le 3 \times 10^5
- 0 \le A_i \le 10^9
入力
入力は以下の形式で標準入力から与えられる。
N K A_1 A_2 \dots A_N
出力
答えを出力せよ。
入力例 1
7 3 2 0 2 3 2 1 9
出力例 1
3
この入力では A=(2,0,2,3,2,1,9) であり、ここから K=3 要素を選んで抜き出して数列 B を得ます。例えば、
- 1,2,3 要素目を抜き出した時、 MEX(B)=MEX(2,0,2)=1
- 3,4,6 要素目を抜き出した時、 MEX(B)=MEX(2,3,1)=0
- 2,6,7 要素目を抜き出した時、 MEX(B)=MEX(0,1,9)=2
- 2,3,6 要素目を抜き出した時、 MEX(B)=MEX(0,2,1)=3
のようになります。
達成可能な MEX の最大値は 3 です。
Score : 300 points
Problem Statement
You are given a length-N sequence of non-negative integers.
When B is a sequence obtained by choosing K elements from A and concatenating them without changing the order, find the maximum possible value of MEX(B).
Here, for a sequence X, we define MEX(X) as the unique non-negative integer m that satisfies the following conditions:
- Every integer i such that 0 \le i < m is contained in X.
- m is not contained in X.
Constraints
- All values in the input are integers.
- 1 \le K \le N \le 3 \times 10^5
- 0 \le A_i \le 10^9
Input
The input is given from Standard Input in the following format:
N K A_1 A_2 \dots A_N
Output
Print the answer.
Sample Input 1
7 3 2 0 2 3 2 1 9
Sample Output 1
3
In this input, A=(2,0,2,3,2,1,9), and you obtain the sequence B by picking K=3 elements. For example,
- If the 1-st, 2-nd, and 3-rd elements are chosen, MEX(B)=MEX(2,0,2)=1.
- If the 3-rd, 4-th, and 6-th elements are chosen, MEX(B)=MEX(2,3,1)=0.
- If the 2-nd, 6-th, and 7-th elements are chosen, MEX(B)=MEX(0,1,9)=2.
- If the 2-nd, 3-rd, and 6-th elements are chosen, MEX(B)=MEX(0,2,1)=3.
The maximum possible MEX is 3.