Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Solution to the Quiz Scoring Problem

Let the four grades be A, B, C, D. Let {A, B, C, D} = {W, X, Y, Z} where


W ≥ X ≥Y ≥ Z
Then the desired grade total is
T = 4W + 3 X + 2Y + Z .

Now we show how to express W, X, Y, and Z in terms of A, B, C, and D, using only the
max and min functions, addition, subtraction, and integer multiplication.

W = max( A, B, C , D )
Z = min( A, B, C , D )
X = max( A, B, C ) + max( A, B, D ) + max( A, C , D ) + max( B, C , D ) − 3max( A, B, C , D )
Y = min( A, B, C ) + min( A, B, D ) + min( A, C , D ) + min( B, C , D ) − 3min( A, B, C , D )

We can now write out T, simplifying a bit to get:

T = 3(max( A, B, C ) + max( A, B, D ) + max( A, C , D ) + max( B, C , D ))


+ 2(min( A, B, C ) + min( A, B, D ) + min( A, C , D ) + min( B, C , D ))
− 5(max( A, B, C , D ) + min( A, B, C , D ))

Implementation: In every spreadsheet that I know of, max and min are binary functions
so that, for example, instead of MAX(A, B, C, D) you would need
MAX(MAX(A, B), MAX(C, D)).

Heuristics: To solve this I tried to find functions W, X, Y, and Z that would work for the
case when A ≥ B ≥ C ≥ D and would be symmetric in the four variables, that is they
would give the same value for any permutation of the variables. Once I got that idea, it
was pretty easy.

Generalization: The same method ought to work for the general case of n scores and
arbitrary weights, that is where the scores are a1 ,..., an and the weighted total is
n

∑ w x where ( x ) consists of the elements a in non-increasing order, by first finding


i =1
i i i i

x1 and xn , then x2 and xn −1 , and so forth, working from the outside to the middle.
However, for more than 4 scores the results would probably be too cumbersome for
practical use.

You might also like