QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 1024 MB Total points: 100

#14381. New Signal Decomposition

统计

We consider a sequence $A$ with $p$ float-point numbers denoted by $a_0, a_1, ..., a_{p-1}$ where $p$ is a prime number. To simplify our problem, we guarantee that $p$ must be $13$, $103$ or $100003$.

To make a decomposition for this sequence, we define the kernal functions $r(h,k) = 2^{sin^3\big(2\pi\frac{hk}{p}\big)}$. Therefore we can get the new sequence $B = \{b_0,b_1,\cdots,b_{p-1}\}$ tranformed from the original sequence $A$ where $b_k = \sum_h a_h * r(h,k)$.

Your mission is to calculate the new sequence $B$.

Input

The first line is the number of test cases. Each test case contains two lines. The first line contains an integer $p$. The second line contains $p$ float-point numbers corresponding to the sequence $A$.

Output

For each test case, output $p$ float-point numbers rounded to three decimal places in one line corresponding to the sequence $B$.

Example

Input

13
7 0 0 0 0 0 0 0 0 0 0 0 0
13
1 2 3 4 5 6 7 8 9 10 11 12 13
13
11 7 7 7 7 7 7 7 7 7 7 7 7

Output

7.000 7.000 7.000 7.000 7.000 7.000 7.000 7.000 7.000 7.000 7.000 7.000 7.000
91.000 85.477 92.015 93.543 91.049 99.763 98.551 98.517 97.304 106.018 103.525 105.053 111.590
95.000 102.032 102.032 102.032 102.032 102.032 102.032 102.032 102.032 102.032 102.032 102.032 102.032
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.