HDU 5268 ZYB loves Score——BestCoder Round #44(模拟)

ZYB loves Score

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)


Problem 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

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.

0A105 0B100
 

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
 

Source
BestCoder Round #44
 
/************************************************************************/

附上该题对应的中文题

ZYB loves Score

 
 
 Time Limit: 2000/1000 MS (Java/Others)
 
 Memory Limit: 65536/65536 K (Java/Others)
问题描述
有一天ZYBZYB参加了一场BestCoderBestCoder,这场比赛一共有44道题,分数分别为10001000,15001500,20002000,25002500。
一道题目如果在第xx分钟解决,那么你只能得到这道题原来分数的(250-x)/250 *100\%(250x)/250100%
由于原分数都是250的倍数,所以分数肯定是整数
当一道题错误提交一次后,这道题的分数会额外降5050分
比如1000分的题你在5分钟时解决,然后你错误提交了一次,分数就是980-50=930
为了防止分数过低,一道题的分数不会低于原来分数的40\%40%
ZYBZYB是个高手,他四道题在最后都通过了
给出他四道题的过题时间和错误提交次数,求他最后的得分
输入描述
一共TT(T \leq 20T20)组数据,对于每组数据:
一共四行,每行一个非负整数AABB,表示这一题在AA分钟获得Accept,错误提交了BB次
第xx行表示第xx0\leq A\leq 1050A1050\leq B\leq 1000B100
输出描述
每组数据输出一行Case #x: ans。x表示组数编号,从1开始。ans为所求值。
输入样例
2
4 0
12 0
20 0
103 0
17 1
29 0
57 0
84 0
输出样例
Case #1: 5722
Case #2: 5412
/****************************************************/

出题人的解题思路:

本题考察了选手的模拟能力,直接按照题目意思计算即可
本题题意很简单,就是按照题目的要求,给你一个选手做出4道题的时间及错误次数,求一下该选手参加一场BestCoder的最后得分。

4道题满分分别为1000、1500、2000、2500,假设该题满分为k分,那么若你做出该题的时间为t,错误的次数为c,则最终该题得分为


按照该公式分别算出4道题的得分,再求和即可

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<queue>
#include<math.h>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<string>
#include<algorithm>
#include<iostream>
#define exp 1e-10
using namespace std;
const int N = 50;
const int inf = 1000000000;
int fun(int t,int k,int c)
{
    int n=2*c/5;
    c=c/250*(250-t)-k*50;
    return c>n?c:n;
}
int main()
{
    int t,i,ans,a,b,j=1;
    scanf("%d",&t);
    while(t--)
    {
        ans=0;
        for(i=0;i<4;i++)
        {
            scanf("%d%d",&a,&b);
            ans+=fun(a,b,1000+i*500);
        }
        printf("Case #%d: %d\n",j++,ans);
    }
    return 0;
}
菜鸟成长记

你可能感兴趣的:(模拟,ACM)