# Neumont Coding Contest 2015

This year, we decided to hold a coding contest at Neumont University. We did a single-elimination, head-to-head competition roughly similar to the Top Coder Single Round Matches, just with two people in a room instead of 20. We started with 50 entrants, whittled it down to 32, and then, five rounds later, we had our winner!Because I was in charge of coming up with the problems, I thought I'd post what they were for each round, what some good (and bad?) solutions were, and anything else that comes to mind.

I'll also possibly post a bit on the coding contest server that I built using Spring 4 to teach myself a bit about Java Config.

## Qualifying Round

First, the rules: Students could use any IDE and could submit solutions in C# or Java. No Internet, but they could bring in pencil and paper. For the qualifying round, students were given the entire day to solve one problem. Students were be ranked in the order they submitted a correct solution up to 32 submissions.So, at 10am on February 17th, students were presented with the following problem:

Betsy is interested in flags whose stars are formatted rectangularly where every odd row is the same length and every even row is one star less than the odd rows.

Furthermore, call the width of this flag the number of stars in its first row and the height the number of rows. Betsy prefers the dimensions to be the closest to a square as possible. In the case of a tie, Betsy prefers flags with more columns than rows.

For example, in the case of a50-star flag,

Betsy likes a flag whose odd rows have6stars and whose even rows have 5 stars (resulting in a flag with 9 rows of stars, 6, 5, 6, 5, 6, 5, 6, 5, 6) as opposed to a flag whose odd rows have 5 stars and whose even rows have 4 stars (resulting in a flag with 10 rows of stars). A 6 x 9 flag is closer to a square than a 5 x 10 flag.

For example, in the case of a46-star flag

Betsy likes a flag whose odd rows have7stars and whose even rows have 6 stars (resulting in a flag with 7 rows of stars, 7, 6, 7, 6, 7, 6, 7)

as opposed to a flag whose odd rows have 12 stars and whose even rows have 11 stars (resulting in a flag with 4 rows of stars). A 7 x 7 flag is closer to a square than a 12 x 4 flag.

Create a Solution that reads in the number of total stars from standard in and prints out the number of stars in the first row of Betsy's preferred flag.

Here are some sample inputs and outputs:

50 -> 6

46 -> 7

115 -> 12

112 -> 4

3 -> 2

459384753 -> 28603

The first correct submission was submitted within 40 minutes of the announced problem, and by the end of the day, 29 students were in. How fast can you complete it? I'll post a couple of solutions and my analysis next time.

## 0 comments: