base2i
Time limit1sMemory limit512 MB
Represent the Gaussian integer x + iy in base 2i, using digits 0 to 3 and exactly one fractional digit, and return it as a string.
- Level
Medium6 of 10
- Topics
- Math, Number theory, Implementation, Simulation
- Solved
- No attempts yet
Problem
Write a function P4:
-
Mr. Park ( years old) has two eyes, so he loves . He wants to advertise the base system.
-
In the base system, each complex number has the following representation: [\cdots d_2d_1d_0.d_{-1}d_{-2}\cdots] which means [\cdots+d_2\cdot b^2+d_1\cdot b^1+d_0\cdot b^0+d_{-1}\cdot b^{-1}+d_{-2}\cdot b^{-2}+\cdots] where , and for each .
-
input parameter: two integers
x,ysatisfyingx,y -
return value: the string representing the complex number
xyin the base system, satisfying the followings:- Each character in the string is one of '
0', '1', '2', '3', '.'. - The string contains exactly one '
.'. - There is exactly one character after '
.'. - The string does not start with '
.'. - The string does not start with '
0' if there are more than one character before '.'.
- Each character in the string is one of '
-
For example,
31.0is the base representation of since