#P13809. [CERC 2022] Denormalization

[CERC 2022] Denormalization

题目描述

Dr. Brodnik prepared a list A=[a1,a2,,aN]A = [a_1, a_2, \ldots, a_N] that contained NN integers. No one knows what exactly these numbers represented, but it is well known that:

  • 1ai100001 \leq a_i \leq 10\,000 for all 1iN1 \leq i \leq N and
  • their greatest common divisor was 1.

Dr. Hočevar decided to do his colleague a favor and normalized the list, as he thought that it represents a vector in the nn-dimensional real vector space. Namely, he calculated the number

$$d = \sqrt{\sum_{i=1}^{N} a_i^2} = \sqrt{a_1^2 + a_2^2 + \cdots + a_N^2} $$

and replaced Dr. Brodnik's list by [a1/d,a2/d,,aN/d][a_1/d, a_2/d, \ldots, a_N/d]. The numbers in this normalized list were also rounded to 12 decimal places for storage. We will refer to the elements of the stored normalized list as X=[x1,x2,,xN]X = [x_1, x_2, \ldots, x_N]. After some time, he realized that it was a mistake and he now wishes to recover the original list AA. Of course, no backup of the original has been made. Since Dr. Hočevar is too busy at the moment doing more important tasks, your help will be much appreciated.

As some data was lost due to rounding, he will be happy with any reconstructed list R=[r1,r2,,rN]R = [r_1, r_2, \ldots, r_N], such that after normalization it would differ from XX by at most 10610^{-6} in each corresponding element.

输入格式

The first line of the input contains an integer NN, i.e. the length of the list XX. The ii-th of the following NN lines contains a floating-point number xix_i with exactly 12 decimal places. It is guaranteed that the input is valid, i.e. it was really obtained in the described manner from a list of integers with the properties described above.

输出格式

The output should contain NN lines containing the reconstructed integers r1,r2,,rNr_1, r_2, \ldots, r_N in this order. You can output any acceptable solution as described above.

6
0.137516331034
0.165019597241
0.275032662068
0.412548993102
0.825097986204
0.165019597241
5
6
10
15
30
6

提示

Input limits

  • 2N100002 \leq N \leq 10\,000
  • 0<xi<10 < x_i < 1 for all 1iN1 \leq i \leq N

Output limits

  • 1ri100001 \leq r_i \leq 10\,000 for all 1iN1 \leq i \leq N
  • gcd(r1,,rN)=1\gcd(r_1, \ldots, r_N) = 1