问题1646--100's GAME

1646: 100's GAME

[命题人 : ]
时间限制 : 1.000 sec  内存限制 : 64 MB

题目描述

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. GAME 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 number+number=sum where there are no intervening spaces. Leading zeros are printed for each number on the left. After a game, the total penalty should be printed, in the form: score: SCORE

样例输入 Copy

675356
2912
7093
6062
6187

202375
9228
9736
1293
1947
8450
3610
6320
6155
4765
6937

样例输出 Copy

Program 8 by team 0
65+35=100
79+21=100
07+93=100
66+26=92
20+81=101
score: 9
23+75=98
02+98=100
22+79=101
31+69=100
21+79=100
43+58=101
40+60=100
33+62=95
51+50=101
46+56=102
61+39=100
score: 12
End of program 8 by team 0

提示

Note that there are potentially many correct optimal plays corresponding to a given game.