Description
MightyHorse isplaying a music game called osu!.
Afterplaying for several months, MightyHorse discoveredthe way of calculating score in osu!:
1. Whileplaying osu!, player need toclick some circles following the rhythm. Each time a player clicks, it willhave three different points: 300, 100 and 50, deciding by how clicking timingfits the music.
2.Calculating the score is quite simple. Each time player clicks and gets P points, the totalscore will add P, whichshould be calculated according to following formula:
P = Point * (Combo * 2 + 1)
Here Point is the point theplayer gets (300, 100 or 50) and Combo is thenumber of consecutive circles the player gets points previously - That means ifthe player doesn't miss any circle and clicks the ith circle, Combo shouldbe i - 1.
Recently MightyHorse meets a high-end osu! player. Afterwatching his replay, MightyHorse findsthat the game is very hard to play. But he is more interested in anotherproblem: What's the maximum and minimum total score a player can get if he onlyknows the number of 300, 100 and 50 points the player gets in one play?
As thehigh-end player plays so well, we can assume that he won't miss any circlewhile playing osu!; Thushe can get at least 50 point for a circle.
Input
Thereare multiple test cases.
Thefirst line of input is an integer T (1 ≤ T ≤ 100), indicatingthe number of test cases.
For eachtest case, there is only one line contains three integers: A (0 ≤ A ≤ 500) - the numberof 300 point he gets, B (0 ≤ B ≤ 500) - the numberof 100 point he gets and C (0 ≤ C ≤ 500) - the numberof 50 point he gets.
Output
For eachtest case, output a line contains two integers, describing the minimum andmaximum total score the player can get.
Sample Input
1
2 1 1
Sample Output
2050 3950
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
int T;
cin>>T;
while(T--)
{
int A,B,C;
cin>>A>>B>>C;
long long mins=0,maxs=0;
maxs=maxs+50*C*(C-1)+50*C;
maxs=maxs+100*B*(2*C+B-1)+100*B;
maxs=maxs+300*A*(A+2*B+2*C-1)+300*A;
mins=mins+300*A*(A-1)+300*A;
mins=mins+100*B*(2*A+B-1)+100*B;
mins=mins+50*C*(2*A+2*B+C-1)+50*C;
cout<<mins<<" "<<maxs<<endl;
}
return 0;
}