The game uses a loop that applies experience. If the XP gain is massive (which often happens on higher floors), the loop moves the Pokémon from level 5 to level 15 (for example) in a single frame of calculation.