hdu 5268 ZYB loves Score 水题

ZYB loves Score

Time Limit: 20 Sec

Memory Limit: 256 MB

题目连接

http://acm.hdu.edu.cn/showproblem.php?pid=5268

Description

One day,ZYB participated in the BestCoder Contest

There are four problems. Their scores are 1000,1500,2000,2500

According to the rules of BestCoder,If you solve one problem at x minutes,
You will get (250-x)/250∗100% of the original scores.

Obviously the final score must be an integer,becasue the original scores are multiple of 250

And if you make x wrong submissions,the score of this problem you get will be reduced by 50∗x

For example, if you solved the first problem in 5 minutes and you make one wrong submisson, the score of this problem is 980-50=930

To prevent very low scores,the lowest score of one problem is 40% of its original score

Input


Multiple test cases, the first line contains an integer T(no more than 20), indicating the number of cases. Each test case contains four lines

For i-th line of each test case there are two integers A,B which means you solved the i-th problem in A minutes and you have made B wrong submissons.

0≤A≤105,0≤B≤100


Output

For each case, the output should occupies exactly one line. The output format is Case #x: ans, here x is the data number begins at 1.

Sample Input

2
4 0
12 0
20 0
103 0
17 1
29 0
57 0
84 0


Sample Output

Case #1: 5722
Case #2: 5412

HINT

 

题意

有一天ZYB参加了一场BestCoder,这场比赛一共有4道题,分数分别为1000,1500,2000,2500。
一道题目如果在第x分钟解决,那么你只能得到这道题原来分数的(250−x)/250∗100%
由于原分数都是250的倍数,所以分数肯定是整数
当一道题错误提交一次后,这道题的分数会额外降50分
比如1000分的题你在5分钟时解决,然后你错误提交了一次,分数就是980-50=930
为了防止分数过低,一道题的分数不会低于原来分数的40%
ZYB是个高手,他四道题在最后都通过了
给出他四道题的过题时间和错误提交次数,求他最后的得分

 

题解:

本题考察了选手的模拟能力,直接按照题目意思计算即可

代码:

 

#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
#include <stack>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define test freopen("test.txt","r",stdin)  
#define maxn 2000001
#define mod 10007
#define eps 1e-9
const int inf=0x3f3f3f3f;
const ll infll = 0x3f3f3f3f3f3f3f3fLL;
inline ll read()
{
    ll x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
//**************************************************************************************

double a[4],b[4],c[4];
int main()
{
    //test;
    int t=read();
    c[0]=1000,c[1]=1500,c[2]=2000,c[3]=2500;
    for(int cas=1;cas<=t;cas++)
    {
        for(int i=0;i<4;i++)
            cin>>a[i]>>b[i];
        int ans=0;
        for(int i=0;i<4;i++)
            ans+=max((250-a[i])/250*c[i]-b[i]*50,(c[i]*0.4));
        printf("Case #%d: %d\n",cas,ans);
    }
    
}

 

posted @ 2015-06-14 09:41  qscqesze  阅读(242)  评论(0编辑  收藏  举报