The emerging mobile-edge computing paradigm provides opportunities for the resource-hungry mobile devices (MDs) to migrate computation. In order to satisfy the requirements of MDs in terms of latency and energy consumption, recent researches proposed diverse computation offloading schemes. However, they either fail to consider the potential computing resources at the edge, or ignore the selfish behavior of users and the dynamic resource adaptability. To this end, we study the computation offloading problem and take into consideration the dynamic available resource of idle devices and the selfish behavior of users. Furthermore, we propose a game theoretic offloading method by regarding the computation offloading process as a resource contention game, which minimizes the individual task execution cost and the system overhead. Utilizing the potential game, we prove the existence of Nash equilibrium (NE), and give a lightweight algorithm to help the game reach a NE, wherein each user can find an optimal offloading strategy based on three contention principles. Additionally, we conduct analysis of computational complexity and the Price of Anarchy (PoA), and deploy three baseline methods to compare with our proposed scheme. Numerical results illustrate that our scheme can provide high-quality services to users, and also demonstrate the effectiveness, scalability and dynamic resource adaptability of our proposed algorithm in a multiuser network.