P1418 [CF1001D] Distinguish plus state and minus state
普及
题目描述

You are given a qubit which is guaranteed to be either in $${ \left| + \right\rangle } = { \frac { 1 } { \sqrt { 2 } } } ( { \left| 0 \right\rangle } + { \left| 1 \right\rangle } )$$ or in $${ \left| - \right\rangle } = { \frac { 1 } { \sqrt { 2 } } } ( { \left| 0 \right\rangle } - { \left| 1 \right\rangle } )$$ state.

Your task is to perform necessary operations and measurements to figure out which state it was and to return 1 if it was a $$|+\rangle$$ state or -1 if it was $$\rightarrow$$ state. The state of the qubit after the operations does not matter.

Input

You have to implement an operation which takes a qubit as an input and returns an integer.

Your code should have the following signature:

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
629430
样例输出
52 test runs out of 100 returned incorrect state. Test failed