There are 3 judges, 3 rounds and 3 judges in this diving competition.

There is also a degree of difficulty from 1 to 3.5 that multiplies with the added score

Suppose Contestant 1 would go first:

Degree of difficulty = 2

Judge 1 would give 9

Judge 2 would give 5

Judge 3 would give 1

Now the highest and lowest scores are removed max and min (don't ask why)

So the total would be10for Contestant1

My programs calculation is - total [0] = total [0] + ((score [0] - max [0] - min [0]) * degree);

Can you correct my formula or tell me something else is wrong?