-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathI.qs
35 lines (34 loc) · 879 Bytes
/
I.qs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
namespace Solution {
open Microsoft.Quantum.Primitive;
open Microsoft.Quantum.Canon;
operation Solve (N : Int, Uf : ((Qubit[], Qubit) => ())) : Bool
{
body
{
// your code here
mutable ret = true;
using (qs = Qubit[N + 1])
{
X(qs[N]);
for (q in qs)
{
H(q);
}
Uf(qs[0..N-1], qs[N]);
for (q in qs[0..N-1])
{
H(q);
}
for (q in qs[0..N-1])
{
if (M(q) == One)
{
set ret = false;
}
}
ResetAll(qs);
}
return ret;
}
}
}