{"raw_statement":[{"iden":"statement","content":"You are given _N_ qubits (1 ≤ _N_ ≤ 8) in zero state . You are also given a bitstring _bits_ which describes a non-zero basis state on _N_ qubits .\n\nYour task is to generate a state which is an equal superposition of and the given basis state:\n\nYou have to implement an operation which takes the following inputs:\n\n*   an array of qubits _qs_,\n*   an arrays of boolean values _bits_ representing the basis state . This array will have the same length as the array of qubits. The first element of this array _bits_\\[0\\] will be _true_.\n\nThe operation doesn't have an output; its \"output\" is the state in which it leaves the qubits.\n\nAn array of boolean values represents a basis state as follows: the _i_\\-th element of the array is true if the _i_\\-th qubit is in state , and false if it is in state . For example, array _\\[true; false\\]_ describes 2-qubit state , and in this case the resulting state should be .\n\nYour code should have the following signature:\n\nnamespace Solution {\n    open Microsoft.Quantum.Primitive;\n    open Microsoft.Quantum.Canon;\n\n    operation Solve (qs : Qubit\\[\\], bits : Bool\\[\\]) : ()\n    {\n        body\n        {\n            // your code here\n        }\n    }\n}"}],"translated_statement":[{"iden":"statement","content":"给定 #cf_span[N] 个量子比特（#cf_span[1 ≤ N ≤ 8]），初始处于零态。同时给定一个比特串 #cf_span[bits]，它描述了 #cf_span[N] 个量子比特上的一个非零基态。\n\n你的任务是生成一个状态，该状态是  和给定基态的等权叠加：\n\n你需要实现一个操作，它接收以下输入：\n\n该操作没有输出；其“输出”是它作用后量子比特所处的状态。\n\n一个布尔值数组表示一个基态的方式如下：数组的第 #cf_span[i] 个元素为 true 表示第 #cf_span[i] 个量子比特处于 状态，false 表示处于 状态。例如，数组 _[true; false]_ 描述 2 量子比特态 ，此时最终状态应为 。\n\n你的代码应具有以下签名：\n\n"}],"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ N \\in \\mathbb{Z} $, $ 1 \\leq N \\leq 8 $, be the number of qubits.  \nLet $ \\mathbf{b} = (b_1, b_2, \\dots, b_N) \\in \\{0,1\\}^N $ be a non-zero bitstring representing a computational basis state $ |\\mathbf{b}\\rangle = |b_1 b_2 \\dots b_N\\rangle $.  \nLet $ |0^N\\rangle = |0\\rangle^{\\otimes N} $ denote the all-zero state.\n\n**Constraints**  \n- $ \\mathbf{b} \\neq \\mathbf{0} $ (i.e., at least one $ b_i = 1 $).\n\n**Objective**  \nImplement a quantum operation that transforms the initial state $ |0^N\\rangle $ into the normalized superposition:  \n$$\n|\\psi\\rangle = \\frac{1}{\\sqrt{2}} \\left( |0^N\\rangle + |\\mathbf{b}\\rangle \\right)\n$$","simple_statement":null,"has_page_source":false}