Weekly Contest for August 30, 2011
From your lab workstation, use these commands to get started…
% mkdir pc2
% cp -p /homes/cs390cp/pc2/pc2v9.ini pc2
Join the Contest
% cd pc2
% /homes/cs390cp/pc2/bin/pc2team &
Log in using your individually assigned “teamX” account and password. You can work in the current window/directory, creating a subdirectory for each problem.
If you've already solved one or more of these problems, try (1) solving again without referring to your old solution, and/or (2) using a different language (Java or C++). If you want to work on an additional problem from this chapter, let me know.
A: The main steps during each “round” of the voting are to (1) compute the number of votes for top-ranked candidates (skipping candidates that have been eliminated), (2) find maximum and minimum number of votes received by each of the top-ranked candidates, and (3) if there is no one with a majority of the votes (and there is no tie), remove candidates with minimum number of votes.
B: Array.sort is your friend.
C: A single array to count each of the possible differences is all it takes.
D: Use this problem to get started on the next one.
E: The solution is not long, but requires a fair amount of bookkeeping. Using objects to represent teams is one way to manage the storage.
F: More tedious than anything. Good parsing practice.