MightyHorse is playing a music game called osu!.
![](http://acm.zju.edu.cn/onlinejudge/showImage.do?name=play_osu.jpg)
After playing for several months, MightyHorse discovered the way of calculating score in osu!:
1. While playing osu!, player need to click some circles following the rhythm. Each time a player clicks, it will have three different points: 300, 100 and 50, deciding by how clicking timing fits the music.
2. Calculating the score is quite simple. Each time player clicks and gets P points, the total score will add P, which should be calculated according to following formula:
Here Point is the point the player gets (300, 100 or 50) and Combo is the number of consecutive circles the player gets points previously - That means if the player doesn't miss any circle and clicks the ith circle, Combo should be i - 1.
Recently MightyHorse meets a high-end osu! player. After watching his replay, MightyHorse finds that the game is very hard to play. But he is more interested in another problem: What's the maximum and minimum total score a player can get if he only knows the number of 300, 100 and 50 points the player gets in one play?
As the high-end player plays so well, we can assume that he won't miss any circle while playing osu!; Thus he can get at least 50 point for a circle.
Input
There are multiple test cases.
The first line of input is an integer T (1 ≤ T ≤ 100), indicating the number of test cases.
For each test case, there is only one line contains three integers: A (0 ≤ A ≤ 500) - the number of 300 point he gets, B (0 ≤ B ≤ 500) - the number of 100 point he gets and C (0 ≤ C ≤ 500) - the number of 50 point he gets.
Output
For each test case, output a line contains two integers, describing the minimum and maximum total score the player can get.
Sample Input
1 2 1 1
Sample Output
2050 3950
Author: DAI, Longao
Contest: The 10th Zhejiang Provincial Collegiate Programming Contest
只需注意一点题目所说的选手不会有任何失误
#include <stdio.h>
int p[4]={0,300,100,50};//存不同等级得分
int main()
{
int a[4],b[4],i,j,t,ma,mi,m,n;
scanf("%d",&t);
while(t--)
{
mi=ma=0;
scanf("%d%d%d",&a[1],&a[2],&a[3]);
b[1]=a[1],b[2]=a[2],b[3]=a[3];//初始化两个数组。减少循环
n=a[1]+a[2]+a[3];
i=3,j=1;
for(m=2*(n-1)+1;m>0;m-=2)//m记录连击数。递减运算
{
while(!a[i])//贪心思想。算最低分
i--;
mi+=p[i]*m;
a[i]--;
while(!b[j])//算最高分
j++;
ma+=p[j]*m;
b[j]--;
}
printf("%d %d\n",mi,ma);
}
return 0;
}
return 0;
}