Athletes' body types can vary greatly, depending on the sport and the training they undergo.

Nothing represents the peak of physical condition like Olympic athletes do, yet they also represent a wide range of body types, shapes and sizes.

Basketball players are generally tall and long-limbed, whereas gymnasts tend to be small and compact. Wrestlers' upper bodies are heavily padded with muscle, while fencers carry more muscle in their lower bodies. Swimmers and divers tend to have a slightly higher percentage of body fat than other athletes, but marathon runners appear to have hardly any body fat at all.

Some differences — like those in height — are genetic, but others are the result of rigorous training specific to an athlete's particular sport. Or, as Los Angeles, California fitness trainer Mark Jenkins told Live Science, "Form follows function." [Exercise and Weight Loss: The Science of Preserving Muscle Mass]

Being a top athlete means strengthening your body to respond to your sport's unique demands, Jenkins said. For example, boxers need to be heavy hitters, but they also need to sustain their endurance through the end of a bout; and carrying more muscle mass requires more oxygen to keep going.

Swimmers also can't be too muscular, as that creates extra drag in the water and can reduce their speed, he said.

"It's a balancing act," Jenkins said, "If you're more muscular, you might be slowing down your aerobic capacity, then it takes a lot more oxygen to keep you going."

But in other cases, body changes happen as a result of adaptation to certain conditions. For example, swimmers generally carry slightly more body fat than other athletes. "The body adapts" to spending long hours in cool water, Jenkins said, adding that a higher percentage of body fat also helps with buoyancy. [Infographic: Body Types of Olympic Athletes]

And some sports require athletes to work on building up a particular part of their bodies to guard against injuries to which they are particularly vulnerable, he added.

For example, basketball players need to strengthen their backs. "Because the athlete is taller, there's more core work involved," Jenkins said. "Their lower back needs to be strong because they're always crouched over."

Wrestlers also need strong backs and muscular upper bodies to grip their opponents and pin them to the mat. And they do special exercises in order to build bulky layers of muscle around their necks to protect their windpipes against chokeholds, Jenkins said.

There are 42 sports and 306 events in the 2016 Olympic Games, in which approximately 10,500 athletes will be competing, according to the Olympic Games website.

How their bodies look and what they do to get them to look that way may vary, but they seek the same goal — to maximize power and agility while also anticipating the wear and tear their sport exacts on their bodies.

"Training for each sport is very specifically to keep that person in peak condition," Jenkins told Live Science. "But it's also to keep that person in the best shape for injury prevention."

Original article on Live Science.