Problem Statement
You are given integers and .
Implement an oracle satisfying the following transition on a quantum circuit with qubits.
For any pair of integers satisfying and , the oracle satisfies
Constraints
- Global phase is ignored in judge.
- Integers must be encoded by little-endian.
- The submitted code must follow the specified format:
from qiskit import QuantumCircuit, QuantumRegister
def solve(n: int, a: int) -> QuantumCircuit:
k, c = QuantumRegister(n), QuantumRegister(1)
qc = QuantumCircuit(k, c)
# Write your code here:
return qc
Hints
Open
- You can consider the following oracle without first.
- Related problem: QCoder Programming Contest 002 - B7
- Quantum fourier transform: QCoder Programming Contest 002 - B4
- You cannot use
qiskit.circuit.library.QFT
in this problem.