PivotOJ

Equalising Audio

시간 제한: 4000ms메모리 제한: 1024MB출처: BAPC 2022BOJ 25996

문제

As a radio engineer at the Balanced Audio Podcast \copyright{} your job is to deliver an equal listening experience at all times. You did a poll among the listeners and they are especially concerned about fluctuations in loudness. To resolve this you bought a transformer to equalise the audio, but alas, its software got corrupted during transport.

Your job is to rewrite the equalising software. As input the transformer gets nn amplitudes a1,,ana_1, \ldots, a_n, with an average perceived loudness of 1ni=1nai2\frac{1}{n}\sum_{i=1}^n a_i^2. The output should contain the same amplitudes, but renormalised by some constant positive factor, such that the average perceived loudness is xx. There is one exception: total silence should always be preserved.

입력

The input consists of:

  • One line with a two integers nn and xx (1n1051\leq n\leq 10^5, 0x106)0 \leq x \leq 10^6), the number of amplitudes and the average perceived loudness to achieve.
  • One line with nn integers a1,,ana_1, \ldots, a_n (ai106\left| a_i \right| \leq 10^6), the amplitudes.

출력

Output one line containing nn numbers, the renormalised amplitudes with an average perceived loudness of xx.

Your answers should have an absolute or relative error of at most 10610^{-6}.

예제

예제 1

입력
5 6
0 1 -2 3 -4
출력
0 1 -2 3 -4

예제 2

입력
4 1
1 3 3 7
출력
0.242535625 0.7276068751 0.7276068751 1.697749375
코드를 제출하려면 로그인하세요.