Hard to Play ZOJ 3712

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 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:

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 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


題解:題目大概意思爲,給你選手獲得300,100,50的次數,並給你分數計算公式,P = Point * (Combo * 2 + 1)

其中point 爲300 100 或50,Combo爲第幾次獲得的point,讓你計算獲得分數的最大值,和最小值

很明顯求最大值時先算50,其次100,最後300,而最小值恰恰相反……



#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string.h>
#include<stdlib.h>
#include<time.h>
#include<string>
#include<math.h>
#include<map>
#include<queue>
#include<stack>
#define INF 0x3f3f3f3f
#define ll long long
#define For(i,a,b) for(int i=a;i<b;i++)
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
int t,a,b,c;
int main()
{
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d%d%d",&a,&b,&c);
        int Max=0,Min=0,p=1;
        for(int i=0; i<a; i++)
        {
            Min+=300*p;
            p+=2;
        }
        for(int i=0; i<b; i++)
        {
            Min+=100*p;
            p+=2;
        }
        for(int i=0; i<c; i++)
        {
            Min+=50*p;
            p+=2;
        }
        p=1;
        for(int i=0; i<c; i++)
        {
            Max+=50*p;
            p+=2;
        }
        for(int i=0; i<b; i++)
        {
            Max+=100*p;
            p+=2;
        }
        for(int i=0; i<a; i++)
        {
            Max+=300*p;
            p+=2;
        }
        printf("%d %d\n",Min,Max);
    }
}












發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章