  We present an algorithm for the generalized search problem (searching $k$
marked items among $N$ items) based on a continuous Hamiltonian and exploiting
resonance. This resonant algorithm has the same time complexity $O(\sqrt{N/k})$
as the Grover algorithm. A natural extension of the algorithm, incorporating
auxiliary "monitor" qubits, can determine $k$ precisely, if it is unknown. The
time complexity of our counting algorithm is $O(\sqrt{N})$, similar to the best
quantum approximate counting algorithm, or better, given appropriate physical
resources.
