ZOJ 3712 Hard to Play

Hard to Play

Time Limit: 2 Seconds      Memory Limit: 65536 KB

MightyHorse is playing a music game called osu!.

After playing for several months, MightyHorse discovered the way of calculating score inosu!:

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:

P = Point * (Combo * 2 + 1)

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 theith 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 playingosu!; 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 andC (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>
using namespace std;
int main()
{
  int t;
  scanf("%d",&t);
  while(t--)
  {
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    int min=0,max=0;
    max=50*(c*c)+100*((b+c)*(b+c)-c*c)+300*((a+b+c)*(a+b+c)-(b+c)*(b+c));
    min=300*(a*a)+100*((a+b)*(a+b)-a*a)+50*((a+b+c)*(a+b+c)-(a+b)*(a+b));
    printf("%d %d\n",min,max);
  }
  return 0;
}


簡單題解:

由上圖題目中所給的公式,可推出(Combo*2+1)通項公式爲n*n。

樣例解釋:

max:

50*(0*2+1)=50

100*(1*2+1)=300

300*(2*2+1)=1500

300*(3*2+1)=2100


min:

300*(0*2+1)=300

300*(1*2+1)=900

100*(2*2+1)=500

50*(3*2+1)=350


又上面所容易得出:

(0*2+1)=1;      


(0*2+1)+(1*2+1)=4;


(0*2+1)+(1*2+1)+(2*2+1)=9;


(0*2+1)+(1*2+1)+(2*2+1)+(3*2+1)=16;


則可得出通項公式n*n。


發佈了41 篇原創文章 · 獲贊 4 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章