← All problemsSign in

Obtain Desired Standard Deviation

Given two integers N and σ, find any array a with length N such that the standard deviation of the elements of the array is equal to σ. The standard deviation is given by the following formula: For each 1 ≤ i ≤ N, ai may be any real number with |ai| ≤ 108. If there is more than one possible answer, you may output any one of them. If there is no such array, output -1 instead. Please note that th

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start