{"raw_statement":[{"iden":"statement","content":"You are given a qubit which is guaranteed to be either in or in state.\n\nYour task is to perform necessary operations and measurements to figure out which state it was and to return 1 if it was a state or -1 if it was state. The state of the qubit after the operations does not matter."},{"iden":"input","content":"You have to implement an operation which takes a qubit as an input and returns an integer.\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 (q : Qubit) : Int\n    {\n        body\n        {\n            // your code here\n        }\n    }\n}"}],"translated_statement":[{"iden":"statement","content":"给定一个量子比特，其状态保证为 $\\ket{0}$ 或 $\\ket{1}$ 状态。\n\n你的任务是执行必要的操作和测量，以确定它原本处于哪种状态，并在它是 $\\ket{1}$ 状态时返回 1，在它是 $\\ket{0}$ 状态时返回 -1。操作后量子比特的状态无关紧要。\n\n你需要实现一个操作，该操作以量子比特作为输入并返回一个整数。\n\n你的代码应具有以下签名：\n\n"},{"iden":"input","content":"你需要实现一个操作，该操作以量子比特作为输入并返回一个整数。你的代码应具有以下签名：namespace Solution {    open Microsoft.Quantum.Primitive;    open Microsoft.Quantum.Canon;    operation Solve (q : Qubit) : Int    {        body        {            // your code here        }    }}"}],"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ \\ket{\\psi} \\in \\{ \\ket{0}, \\ket{1} \\} $ be the unknown initial state of a qubit.\n\n**Objective**  \nDesign a quantum operation that, given $ \\ket{\\psi} $, returns:  \n$$\n\\begin{cases}\n1 & \\text{if } \\ket{\\psi} = \\ket{0} \\\\\n-1 & \\text{if } \\ket{\\psi} = \\ket{1}\n\\end{cases}\n$$  \nusing quantum gates and a measurement in the computational basis. The final state of the qubit is irrelevant.","simple_statement":null,"has_page_source":false}