#C2704. Normalize Vector using L2 Norm
Normalize Vector using L2 Norm
Normalize Vector using L2 Norm
You are given an integer (n) and a list of (n) floating-point numbers representing a vector. Your task is to compute the normalized vector where each component is divided by the L2 norm of the vector. The L2 norm is defined as (|v|2 = \sqrt{\sum{i=1}^{n} v_i^2}). If the vector is the zero vector (i.e. every component is zero), then output the vector itself unchanged.
inputFormat
The input is read from standard input. The first line contains an integer (n), representing the dimension of the vector. The second line contains (n) space-separated floating-point numbers representing the components of the vector.
outputFormat
Output the normalized vector as (n) floating-point numbers separated by a space. Each number should be printed with 6 decimal places.## sample
3
3.0 4.0 0.0
0.600000 0.800000 0.000000