Can't help snacking after completing a difficult mental task? Turns out, exercise might keep you from overeating.

Researchers from the University of Alabama at Birmingham studied 38 undergraduates to see if exercising for 15 minutes after a graduate-level exam affected how much they ate. To establish a baseline, all the students rested for 35 minutes — and instructed not to do anything mentally or physically stimulating — then were offered all the pizza they could eat.

 A week later, students were divided into two groups: one that rested for 15 minutes after a graduate-level exam, another that participated in high-intensity interval exercise for 15 minutes following the exam.

The exercisers ate 25 fewer calories than when they relaxed before eating. Those who rested after the exam, however, ate an average of 100 more calories than when they relaxed the previous week.

The results were published this month in the journal Medicine & Science in Sports & Exercise.

William Neumeier, Ph.D., lead author of the study, said, “Previous studies have shown that mentally demanding tasks, such as a big test, grant deadlines or other mentally strenuous tasks we perform every day, affect the brain’s energy demands, and increases in food intake were observed following such tasks. In this study, we explore whether glucose and lactate produced through exercise could serve as a way to provide additional energy for brain function, instead of food consumption.”

Researchers need to learn more about how glucose and lactate affect mental work, according to the study's authors. The study participants who exercised saw a significant increase in their lactate levels, but none in their blood-glucose levels.

“One possible explanation is exercise’s effect on hunger and satiety hormones may decrease energy intake after activities that stimulate one’s appetite,” Neumeier said. “Our findings corroborate findings by other research groups and build on them by being the first to report a statistically significant difference in energy intake between participants’ completing mental work and a meal, or mental work and exercise then a meal.”