Set div columns in a loop by post count

I’m trying to post images from a custom post type into columns based on the amount of posts that are returned in the loop.
This is my code:

<?php 
// args  
$args = array(
    'numberposts'   => -1,
    'post_type'     => 'sponsor',
    'meta_key'      => 'sponsor_headline',
    'meta_value'    => 'Partner'
);
// query
$the_query = new WP_Query( $args );

?>
<?php if( $the_query->have_posts() ): ?> <h1>Partners<h1><hr>
    <?php while( $the_query->have_posts() ) : $the_query->the_post();
if($post_count=1){
echo '<div class="flex_column av_one_fifth flex_column_div"></div><div class="flex_column av_one_fifth flex_column_div"></div><div class="flex_column av_one_fifth flex_column_div"><a target="_blank" href="'.get_field('sponsor_url').'"><img src='. get_field('sponsor_logo').' alt="" /></a></div><div class="flex_column av_one_fifth flex_column_div"></div><div class="flex_column av_one_fifth flex_column_div"></div>'; 
} elseif($post_count=2) {
echo '2;
} elseif($post_count=3) {
echo '3';
} elseif($post_count=4) {
echo '4';
} else {
echo '<div class="flex_column av_one_fifth flex_column_div"><a target="_blank" href="'.get_field('sponsor_url').'"><img src='. get_field('sponsor_logo').' alt="" /></a></div>';
}?>
    <?php endwhile; ?><div class="clear"></div>
<?php endif; ?>
<?php wp_reset_query();  // Restore global post data stomped by the_post(). ?>

I’m hoping to achieve that no matter what they will always be the same size: but depending on what the post count is they will be differently placed: This is graphically what I’m looking for (where x would be the post in the 5 column grid being created:

if ($post_count=1){
| | |x| | |
} elseif($post_count=2) {
| |x| |x| |
} elseif($post_count=3) {
|x| |x| |x|
} elseif($post_count=4) {
|x|x|x|x| |
} else {
|x|x|x|x|x|

Any ideas?

Solutions Collecting From Web of "Set div columns in a loop by post count"