In this paper, we develop an approach to inverse optimal control for a class of hybrid dynamical system with impacts. As it is usually posed, the problem of inverse optimal control is to find a cost function that is consistent with an observed sequence of decisions, under the assumption that these decisions are optimal. We assume instead that observed decisions are only approximately optimal and find a cost function that minimizes the extent to which these decisions violate first-order necessary conditions for optimality. For the hybrid dynamical system that we consider with a cost function that is a linear combination of known basis functions, this minimization is a convex program. In fact, it reduces to a simple least-squares computation that - unlike most other forms of inverse optimal control - can be solved very efficiently. We apply our approach to a dynamic bipedal climbing robot in simulation, showing that we can recover cost functions from observed trajectories that are consistent with two different modes of locomotion.