[Cpp]
/** This question is the minimum number of moves, that is, compare the number of bottles of the same color in the first box,
* Apply this rule in the remaining two boxes, and finally obtain a total of six moving orders,
* Define the sequence in six cases and the color strings of the final boxes respectively as struct and list them,
* Calculate the minimum number of moves and the Lexicographic Order of the color string.
*/
# Include <cstdio>
# Include <iostream>
# Include <algorithm>
Using namespace std;
# Define NUM 9
# Define WAY 6
# Define MAX 11
# Define INF 0x7fffffff
Int arr [MAX];
Struct way {
Int a, B, c;
String color;
} Way [] = {
{, 9, "BGC" },{, 6, "BCG" },{, 9, "GBC "},
{, 3, "CBG" },{, 2, 6, "GCB" },{, 3, "CGB "}
};
Int main (){
Int maxv, count, sum;
String str;
While (~ Scanf ("% d", & arr [1]) {
Maxv =-INF;
Count = arr [1];
For (int I = 2; I <= NUM; I ++ ){
Scanf ("% d", & arr [I]);
Count + = arr [I];
}
For (int I = 0; I <WAY; I ++ ){
Sum = arr [way [I]. a] + arr [way [I]. B] + arr [way [I]. c];
If (maxv <sum) {maxv = sum; str = way [I]. color ;}
Else if (maxv = sum & str> way [I]. color) str = way [I]. color;
}
Cout <str <''<count-maxv <endl;
}
Return 0;
}