Solutions of boundary value problems at resonance with periodic and antiperiodic boundary conditions