# The Coding Contest

A coding competition in Netopia pitted each PHP Programmer contestant against every VB Programmer and C++ Programmer contestant, each VB Programmer contestant against every PHP and C++ contestant, and each C++ contestant against every PHP and VB contestant in three contests of programming skills:

1. Writing a CRUD app,

2. Writing an Ecommerce app,

3. Writing a Mobile app.

In other words, each type of programmer —- PHP, VB, and C++ — competed against everyone in the other programming groups in three different contests.

These facts are known:

1. The number of C++ programmers in the tournament was one fewer than the number of PHP programmers.

2. Nine of the contestants were either VB or C++ programmers.

3. The number of PHP programmers vs. VB programmer competitions in the three skills was seventy-two; there were more VB Programmers than PHP programmers.

4. Twenty-seven contests were held each day.

## How many days did the coding tournament last?

• The puzzle itself is quite nice, but since being a C++ programmer does not inherently rule out the possibility of also being a VB programmer (and so on), it seems like some other context might have been less prone for possible misinterpretations. Giving the teams their own jerseys might fix this, as would being careful to always use "members of the PHP team" when that was intended.
– Bass
Apr 11, 2020 at 22:31
• I, too, am a fellow C++ programmer - for the last 3 years in the office anyways. I used to be a devoted PHP guy - from 01 to about 15. Anyways, when we create or post puzzles I try to put a tech twist on them. LOL I am fought most of the way by those who help me. I definitely agree though, we could make the puzzles more interesting ( or flow better ) if we used scenarios other then the tech industry. I'll make you a deal, next one will be sport team related as you mentioned. :) Apr 11, 2020 at 22:39

The tournament took

6 days.

From fact 3 we get that there were $$72 / 3 = 24$$ matches in each of the three contests.

Since the number of matches in a contest between 2 teams is decided by

multiplying together the number of participants in the teams

we get these possible combinations (remembering that there were more VBs than PHPs):

$$24_{VB} \times 1_{PHP}$$ $$12_{VB} \times 2_{PHP}$$ $$8_{VB} \times 3_{PHP}$$ $$6_{VB} \times 4_{PHP}$$

Fact 2 rules out the first 2 possibilities outright, and adding in fact 1 also rules out the third one.

So the number of contestants were

$$6_{VB}, 4_{PHP}, 3_{C++}$$

So the total number of matches in a contest was

$$6\times4 + 6\times3 + 4\times3 = 24 + 18 + 12 = 54$$

Which we then multiply by 3 contests and divide by 27 matches per day to get the final result.

• D'oh. I had the right solution and answer except I forgot to multiply by three at the end for the three different competitions. I'll just delete my answer post, then.... Apr 11, 2020 at 22:18
• @Everyone - I should have asked this long ago, but are we supposed to accept an answer the moment it appears, or let it be viewed and played a while before accepting an answer? If we immediately accept an answer, does that in any way affect the puzzle, for instance, are solved puzzles shown after ones awaiting an answer? Apr 12, 2020 at 0:27
• @JohnS. it’s generally down to the posters preference, but accepting an answer does not affect the way it is shown on the site at all, so it’s down to you, there’s no site guidelines here :) Apr 12, 2020 at 0:40