Existence of solutions of a class of nonlinear nonlocal problems involving the potential