Editorial for Inaho VI


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Author: Ninjaclasher

Without prior knowledge on the basics of complex numbers, this problem is impossible to solve. For example, it must be known that i = \sqrt{-1} and that the rectangular coordinate form of a complex number is z = a + bi.

For the first subtask, since x \le 1, we can utilize a simple if statement. If x = 0, the solution is 1 + 0i. If x = 1, the solution is simply 0 + 1i.

For the second subtask, some quick Googling will give the solutions to when x = 2 and when x = 3. When x = 2, the solution is e^{-\frac{\pi}{2}} \approx 0.20788 + 0i. When x = 3, the solution is e^{\frac{\pi i e^{-\frac{\pi}{2}}}{2}} \approx 0.94716 + 0.32076i. Alternatively, one can solve for when x = 2 and x = 3 manually using Euler's formula.

For the third subtask, one can utilize a for loop that iterates from 1 to x. Start with 2 floating-point variables, a_0 set to 1, and b_0 set to 0. At each iteration of the for loop, it can be found that:

a_i = e^{-\frac{\pi b_{i-1}}{2}}\ cos \frac{\pi a_{i-1}}{2} and b_i = e^{-\frac{\pi b_{i-1}}{2}}\ sin \frac{\pi a_{i-1}}{2}.

Alternatively, one can utilize a complex numbers library in their preferred programming language.

For the last subtask, one can figure out that solution converges to approximately 0.4383 + 0.3606i, which means that after a certain x, the solution becomes consistent up to 4 decimal places. This means that we can hard code a value instead of looping up to x. This certain x and the proof is left as an exercise for the reader.

Time Complexity: O(x)


Comments

There are no comments at the moment.