Skip to content

Commit 61efba5

Browse files
Figure out direction of CNOT
1 parent c10a237 commit 61efba5

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

1357/A1.qs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
namespace Solution {
2+
open Microsoft.Quantum.Intrinsic;
3+
4+
operation Solve (unitary : (Qubit[] => Unit is Adj+Ctl)) : Int {
5+
mutable result = -1;
6+
7+
using (qs = Qubit[2]) {
8+
X(qs[0]);
9+
10+
unitary(qs);
11+
12+
if (M(qs[1]) == One) {
13+
set result = 0;
14+
} else {
15+
set result = 1;
16+
}
17+
18+
ResetAll(qs);
19+
}
20+
21+
return result;
22+
}
23+
}

0 commit comments

Comments
 (0)