Math Quiz
InterviewTime limit1sMemory limit1024 MB
Given N integers A_k, find real p and q so that the sum of omega^A_k equals p*omega + q, where omega is a root of x^2 + x + 1 = 0.
- Level
Easy3 of 10
- Topics
- Math, Implementation
- Solved
- No attempts yet
Problem
Eric wants to give a math quiz to KSA freshmen. To be precise, he wants the freshmen to reduce the number of terms in a math expression so that he can finish his own homework neatly.
Let be one complex root of the quadratic equation . Given integers , find two real numbers and that satisfy the following equation.
Solve this quiz on behalf of the KSA freshmen!
Input
The first line contains an integer .
The second line contains integers .
Output
Print the two real numbers and described in the problem. Answers with an absolute or relative error up to are accepted.