Изменения рейтингов за последние раунды временно удалены. Скоро они будут возвращены. ×

A4. Generate W state
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

You are given N = 2k qubits (0 ≤ k ≤ 4) in zero state . Your task is to create a generalized W state on them. Generalized W state is an equal superposition of all basis states on N qubits that have Hamming weight equal to 1:

For example, for N = 1, .

You have to implement an operation which takes an array of N qubits as an input and has no output. The "output" of the operation is the state in which it leaves the qubits.

Your code should have the following signature:

namespace Solution {
open Microsoft.Quantum.Primitive;
open Microsoft.Quantum.Canon;

operation Solve (qs : Qubit[]) : ()
{
body
{
// your code here
}
}
}