Problem A can be solved without searching. There is a linear solution.

It's quite obvious to note all the Ys sum to 1 and all the scores are the 
same, this is detailed in the analysis.

The next thing to notice is that you can express the difference of each 
Yi-Yj as (Jj-Ji)/X, where X is the sum of all the scores.
Then  (Y1 - Y2) + 2(Y2 - Y3) + 3(Y3 - Y4) + ... = Y1 + Y2 + Y3  + ... - N 
Y1 = 1 - N Y1 = 1/X (1-N J1).
You can then go through and calculate all of the Ys and take care of the 
exception mentioned in the analysis by noting negative numbers, setting 
them to zero, and then renormalizing the percentages.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-code/-/R2QMNWVhufgJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.

Reply via email to