On a nonresonance condition for a semilinear elliptic problem