The following languages are only available languages for the problems from the contest

Microsoft Q# Coding Contest - Summer 2018 - Warmup:

- Microsoft Q#

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.

No tag edit access

G. Oracle for f(x) = k-th element of x

time limit per test

1 secondmemory limit per test

256 megabytesinput

standard inputoutput

standard outputImplement a quantum oracle on *N* qubits which implements a function *f*(*x*) = *x*_{k}, i.e. the value of the function is the value of the *k*-th qubit.

For an explanation on how the quantum oracles work, see the tutorial blog post.

Input

You have to implement an operation which takes the following inputs:

- an array of qubits
*x*(input register), - a qubit
*y*(output qubit), - 0-based index of the qubit from input register
*K*().

The operation doesn't have an output; the "output" of your solution is the state in which it left the qubits.

Your code should have the following signature:

namespace Solution {

open Microsoft.Quantum.Primitive;

open Microsoft.Quantum.Canon;

operation Solve (x : Qubit[], y : Qubit, k : Int) : ()

{

body

{

// your code here

}

}

}

Codeforces (c) Copyright 2010-2019 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Oct/19/2019 13:44:16 (e1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|