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=1 and that the rectangular coordinate form of a complex number is z=a+bi.

For the first subtask, since x1, 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π/20.20788+0i. When x=3, the solution is eπieπ/2/20.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, a0 set to 1, and b0 set to 0. At each iteration of the for loop, it can be found that:

ai=eπbi1/2cosπai12bi=eπbi1/2sinπai12

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

For the last subtask, one can figure out the 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 hardcode 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.