The following languages are only available languages for the problems from the contest
Microsoft Q# Coding Contest - Summer 2018:
Microsoft Q#
→ Virtual participation
Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.
You are given N qubits (2 ≤ N ≤ 8) which are guaranteed to be in one of the two states:
state, or
state.
Your task is to perform necessary operations and measurements to figure out which state it was and to return 0 if it was state or 1 if it was W state. The state of the qubits after the operations does not matter.
You have to implement an operation which takes an array of N qubits as an input and returns an integer.
Your code should have the following signature:
namespace Solution { open Microsoft.Quantum.Primitive; open Microsoft.Quantum.Canon;
operation Solve (qs : Qubit[]) : Int { body { // your code here } } }