  In this paper, we employ a nonlocal $Q$-curvature flow inspired by
Gursky-Malchiodi's work \cite{gur_mal} to solve the prescribed $Q$-curvature
problem on a class of closed manifolds: For $n \geq 5$, let $(M^n,g_0)$ be a
smooth closed manifold, which is not conformally diffeomorphic to the standard
sphere, satisfying either Gursky-Malchiodi's semipositivity hypotheses: scalar
curvature $R_{g_0}>0$ and $Q_{g_0} \geq 0$ not identically zero or Hang-Yang's:
Yamabe constant $Y(g_0)>0$, Paneitz-Sobolev constant $q(g_0)>0$ and $Q_{g_0}
\geq 0$ not identically zero. Let $f$ be a smooth positive function on $M^n$
and $x_0$ be some maximum point of $f$. Suppose either (a) $n=5,6,7$ or
$(M^n,g_0)$ is locally conformally flat; or (b) $n \geq 8$, Weyl tensor at
$x_0$ is nonzero. In addition, assume all partial derivatives of $f$ vanish at
$x_0$ up to order $n-4$, then there exists a conformal metric $g$ of $g_0$ with
its $Q$-curvature $Q_g$ equal to $f$. This result generalizes Escobar-Schoen's
work [Invent. Math. 1986] on prescribed scalar curvature problem on any locally
conformally flat manifolds of positive scalar curvature.
