#P17217. [ICPC 2017 Nanning R] Five Dimensional Discrete Fourier Transform
[ICPC 2017 Nanning R] Five Dimensional Discrete Fourier Transform
Problem Description
The five dimensional discrete fourier transform over a complex array where $0 \le i_1 \le n_1-1, 0 \le i_2 \le n_2-1, 0 \le i_3 \le n_3-1, 0 \le i_4 \le n_4-1$ and is given by:
$$A[j_1][j_2][j_3][j_4][j_5] = \sum_{i_1=0}^{n_1-1} \cdots \sum_{i_5=0}^{n_5-1} a[i_1][i_2][i_3][i_4][i_5] e^{-2 \pi \sqrt{-1} (i_1 j_1 / n_1 + \cdots + i_5 j_5 / n_5)}$$for $0 \le j_1 \le n_1 - 1, \dots, 0 \le j_5 \le n_5 - 1$.
Now comes your turn. For a given real coefficient , suppose
$$a[i_1][i_2][i_3][i_4][i_5] = (i_1 \text{ xor } i_2 \text{ xor } i_3 \text{ xor } i_4 \text{ xor } i_5) e^{\sqrt{-1}(i_1 - i_2 + i_3 - i_4 + i_5) \alpha}$$Please calculate the value of
$$\frac{1}{(n_1 n_2 n_3 n_4 n_5)^{1.5}} \sum_{j_1=0}^{n_1-1} \cdots \sum_{j_5=0}^{n_5-1} |\text{Re}(A[j_1][j_2][j_3][j_4][j_5])|,$$where means the real part of a complex number and means the absolute value of a real number.
Input Format
The first line of the input contains an integer indicating the total number of test cases. For each test case, a line contains five integers where , and a float number with at most significant digits.
Output Format
For each test case, output the value with the precision of digits.
5
1 1 1 1 2 9.8
1 1 1 1 4 3.14
1 2 1 2 1 8.777
2 1 1 1 2 8.777
1 2 3 2 1 20.1314
0.657911
1.499989
0.398713
0.398713
0.942596