Play to win the 100's game. This is a children's math game.
A sequence of 100's game deals. Each card is marked with a single digit. The first line lists six cards. Each subsequent deal is four cards until the end of the game, marked by a blank line or the end-of-file. A typical input file would look like this:
column 111111111122222222223 123456789012345678901234567890 line 1:675356[EOL] 2:2912[EOL] 3:7093[EOL] 4:6062[EOL] 5:6187[EOL] 6:[EOL] 7:202375[EOL] 8:9228[EOL] 9:9736[EOL] 10:1293[EOL] 11:1947[EOL] 12:8450[EOL] 13:3610[EOL] 14:6320[EOL] 15:6155[EOL] 16:4765[EOL] 17:6937[EOL] :[EOF]
After each deal, you have six cards in your hands. You play by choosing two pairs of cards so they represent numbers between 00 and 99. Your goal is to pick them so that the sum of the two numbers is as close as possible to 100. Your score (a penalty) is how close to 100 your sum is.
Even though the sequence of cards is represented in the input file, in actual play you are not aware of which cards will come next. Therefore, your algorithm must be greedy: choosing one of the best plays of the given hand irrespective of how that may benefit or cost the value of a later hand.
After you play, the cards you play are discarded, but the two remaining are left for the next round of cards.
Your score is the sum of penalties for each hand.
For each round, you should generate a line of output corresponding to (one of the) closest picks available from your hand. The format for this is
column 111111111122222222223 123456789012345678901234567890 line 1:Program 8 by team 0[EOL] 2:65+35=100[EOL] 3:79+21=100[EOL] 4:07+93=100[EOL] 5:66+26=92[EOL] 6:20+81=101[EOL] 7:score: 9[EOL] 8:23+75=98[EOL] 9:02+98=100[EOL] 10:22+79=101[EOL] 11:31+69=100[EOL] 12:21+79=100[EOL] 13:43+58=101[EOL] 14:40+60=100[EOL] 15:33+62=95[EOL] 16:51+50=101[EOL] 17:46+56=102[EOL] 18:61+39=100[EOL] 19:score: 12[EOL] 20:End of program 8 by team 0[EOL] :[EOF]
Note that there are potentially many correct optimal plays corresponding to a given game.