C - Order
Editorial
/
Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 8 点
問題文
整数 N, M に対して、文字列 S_{N,M} を以下のように定義します。
- S_{N,M} は
o
とx
からなる長さ M の文字列である。 - S_{N,M} の前から k 文字目は、N^k≤10^9 であれば
o
、そうでなければx
である。
整数 N, M が与えられるので、S_{N,M} を出力してください。
制約
- N, M は整数である。
- 1≤N≤10^9
- 1≤M≤10^5
入力
入力は以下の形式で標準入力から与えられる。
N M
出力
S_{N,M} を出力せよ。
入力例 1
1000 5
出力例 1
oooxx
S_{1000,5} は以下のように求められます。
- 前から 1 文字目は、1000^1=10^3≤10^9 であるから、
o
である。 - 前から 2 文字目は、1000^2=10^6≤10^9 であるから、
o
である。 - 前から 3 文字目は、1000^3=10^9≤10^9 であるから、
o
である。 - 前から 4 文字目は、1000^4=10^{12}>10^9 であるから、
x
である。 - 前から 5 文字目は、1000^5=10^{15}>10^9 であるから、
x
である。
入力例 2
2 30
出力例 2
ooooooooooooooooooooooooooooox
入力例 3
31622 30
出力例 3
ooxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Score : 8 points
Problem Statement
For integers N and M, let us define S_{N,M} as follows.
- S_{N,M} is a string of length M consisting of
o
andx
. - The k-th character from the beginning of S_{N,M} is
o
if N^k≤10^9 andx
otherwise.
Given the integers N and M, print S_{N,M}.
Constraints
- N and M are integers.
- 1≤N≤10^9
- 1≤M≤10^5
Input
Input is given from Standard Input in the following format:
N M
Output
Print S_{N,M}.
Sample Input 1
1000 5
Sample Output 1
oooxx
S_{1000,5} is found as follows.
- The 1-st character from the beginning is
o
because 1000^1=10^3≤10^9. - The 2-nd character from the beginning is
o
because 1000^2=10^6≤10^9. - The 3-rd character from the beginning is
o
because 1000^3=10^9≤10^9. - The 4-th character from the beginning is
x
because 1000^4=10^{12}>10^9. - The 5-th character from the beginning is
x
because 1000^5=10^{15}>10^9.
Sample Input 2
2 30
Sample Output 2
ooooooooooooooooooooooooooooox
Sample Input 3
31622 30
Sample Output 3
ooxxxxxxxxxxxxxxxxxxxxxxxxxxxx