H - Hard to Play
MightyHorse is playing a music game called osu!.
<center>
After playing for several months, MightyHorsediscovered 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 <var>P</var> points, the total score will add <var>P</var>, which should be calculated according to following formula:
<center> <var>P</var> = <var>Point</var> * (<var>Combo</var> * 2 + 1) </center>
Here <var>Point</var> is the point the player gets (300, 100 or 50) and <var>Combo</var> is the number of consecutive circles the player gets points previously - That means if the player doesn't miss any circle and clicks the <var>i</var>th circle, <var>Combo</var> should be <var>i - 1</var>.
Recently MightyHorse meets a high-end osu!player. After watching his replay, MightyHorsefinds 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 <var>T</var> (1 ≤ <var>T</var>≤ 100), indicating the number of test cases.
For each test case, there is only one line contains three integers: <var>A</var> (0 ≤ <var>A</var> ≤ 500) - the number of 300 point he gets, <var>B</var> (0 ≤ <var>B</var> ≤ 500) - the number of 100 point he gets and <var>C</var> (0 ≤ <var>C</var> ≤ 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


1 #include<stdio.h> 2 #include<ctype.h> 3 #include<string.h> 4 int main() 5 { 6 int t; 7 int a,b,c; 8 int p1,p2,p3,p4,p5,p6; 9 int mins,maxs; 10 while(scanf("%d",&t)!=EOF) 11 { 12 mins=0; 13 maxs=0; 14 while(t--) 15 { 16 /* mins=0; 17 maxs=0;*/ 18 p1=p2=p3=p4=p5=p6=0; 19 scanf("%d%d%d",&a,&b,&c); 20 for(int i=0;i<a;i++) 21 { 22 p1+=300*(i*2+1); 23 } 24 for(int i=a;i<a+b;i++) 25 { 26 p2+=100*(i*2+1); 27 } 28 for(int i=a+b;i<a+b+c;i++) 29 { 30 p3+=50*(i*2+1); 31 } 32 mins=p1+p2+p3; 33 34 for(int j=0;j<c;j++) 35 { 36 p4+=50*(j*2+1); 37 } 38 for(int j=c;j<c+b;j++) 39 { 40 p5+=100*(j*2+1); 41 } 42 for(int j=c+b;j<a+b+c;j++) 43 { 44 p6+=300*(j*2+1); 45 } 46 maxs=p4+p5+p6; 47 printf("%d %d\n",mins,maxs); 48 } 49 50 } 51 return 0; 52 }