问题 H: ACM-ICPC亚洲区域赛ZZULI站

问题 H: ACM-ICPC亚洲区域赛ZZULI站

时间限制: 1 Sec  内存限制: 128 MB
提交: 72  解决: 30
[状态] [讨论版] [提交] [命题人:]
题目描述
玩了这么多游戏,V决定还是去做几道ACM题练练手,于是翻到了一道201X年ACM/ICPC亚洲区域赛某站的现场赛签到试题,但是由于多年不刷题,已经忘了怎么做了
作为将来的ACM校队扛把子的你,请帮助他解决一下吧。
现场赛题目如下:
Jenny likes balls. He has some balls and he wants to arrange them in a row on the table.
Each of those balls can be one of three possible colors: red, yellow, or blue. More precisely, Jenny has R red balls, Y yellow balls and B blue balls.
He may put these balls in any order on the table, one after another.
Each time Jenny places a new ball on the table, he may insert it somewhere in the middle (or at one end) of the already-placed row of balls.
Additionally, each time Jenny places a ball on the table, he scores some points (possibly zero). The number of points is calculated as follows:
1.For the first ball being placed on the table, he scores 0 point.
2.If he places the ball at one end of the row, the number of points he scores equals to the number of different colors of the already-placed balls (i.e. expect the current one) on the table.
3.If he places the ball between two balls, the number of points he scores equals to the number of different colors of the balls before the currently placed ball,
  plus the number of different colors of the balls after the current one.
What's the maximal total number of points that Jenny can earn by placing the balls on the table? 



hint:对于志在区域赛的acmer们,数学思维和英语读题能力是必不可少的 : )
hint again: 感谢husy(胡胜勇)对本次周赛试题的数据测试及标程提供
输入
多实例
输入T,表示共有T组数据(T=100)
每组数据包含三个整数R,Y,B  (0<= R,Y,B <=10000)
输出
对于每组输入,输出最高得分
样例输入 Copy
3
2 2 2
3 3 3
4 4 4
样例输出 Copy
15
33
51