CF1001A.Generate plus state or minus state

传统题 时间 2000 ms 内存 256 MiB 5 尝试 1 已通过 1 标签

Generate plus state or minus state

You are given a qubit in state and an integer sign.

Your task is to convert the given qubit to state if sign = 1 or if sign =  - 1.

Input

You have to implement an operation which takes a qubit and an integer as an input and has no output. The "output" of your solution is the state in which it left the input qubit.

Your code should have the following signature:

namespace Solution {  
    open Microsoft.Quantum.Primitive;  
    open Microsoft.Quantum.Canon;  
  
    operation Solve (q : Qubit, sign : Int) : ()  
    {  
        body  
        {  
            // your code here  
        }  
    }  
}

在线编程 IDE

建议全屏模式获得最佳体验