1001A.md (1096B)
1 Source: https://codeforces.com/problemset/problem/1001/A 2 3 A. Generate plus state or minus state 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 You are given a qubit in state  and an integer *sign*. 22 23 Your task is to convert the given qubit to state  if *sign* = 1 or  if *sign* = - 1. 24 25 Input 26 27 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. 28 29 Your code should have the following signature: 30 31 ``` 32 namespace Solution { 33 open Microsoft.Quantum.Primitive; 34 open Microsoft.Quantum.Canon; 35 36 operation Solve (q : Qubit, sign : Int) : () 37 { 38 body 39 { 40 // your code here 41 } 42 } 43 } 44 ```