NBUT 1449 Annie (模拟)

  • [1449] Annie

  • 时间限制: 1000 ms 内存限制: 65535 K
  • 问题描述
  • Annie is a kawaii loli in League of LegendsHigh Councilor Kiersta Mandrake said thatAnnie may be one of the most powerful champions ever to have fought in a Field of Justice.

     

    Annie has an ability, Molten Shield(熔岩护盾). This shield increases Annie's armor and magic resist and damages enemies who hit Annie with basic attacks.

     

    This ability keeps for 5 seconds and cost 10 seconds to cold down to cast next Molten Shield.

     

    We assume that Annie casts the Molten at the very beginning of 0 second. And she casts the next Molten Shield when it colds down immediately. The magic damage of the base attack when she is under the shield is 60 + (0.2 * Spell Power).

     

    We give you the spell power of Annie's and the time of enemies' each base attack. You should tell me how much damage Anniemade via the Molten Shield.

  • 输入
  • This problem contains several cases.
    The first line of each case contains two integers N and S, indicate the number of attack times and the spell power of Annie's. (0 < N ≤ 1000, 0 < s ≤ 1000)
    Then N lines followed. Each line is a decimal number that indicates the time moment of that base attack. The decimal number will not exceeds 1000.
  • 输出
  • You should output the magic damage via the Molten Shield. 1 decimal places reserved.
  • 样例输入
  • 5 301
    2.00
    5.01
    5.00
    8.00
    14.03
  • 样例输出
  • 360.6
  • 提示
  • 来源
  • XadillaX

题意:黑暗之女-安妮(我最爱的英雄~~~)的E技能是一个可以造成一个魔法伤害的顿,对于物理伤害开了盾之后就能给造成物理伤害的攻击者一个魔法伤害,盾持续5秒,CD10秒,给出物理伤害的时间,求安妮能够造成的魔法伤害。

分析:模拟,注意的就是,开了盾就CD,而不是盾结束了才CD。

#pragma comprint(linker, "/STACK:1024000000,1024000000")
#include<cstdio>
#include<string>
#include<iostream>
#include<cstring>
#include<cmath>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<stdlib.h>
#include<time.h>
#include<algorithm>
#define LL __int64
#define FIN freopen("in.txt","r",stdin)
using namespace std;
const int MAXN=1000+5;
const double eps=1e-9;
double t[MAXN];
int main()
{
    //FIN;
    int n;
    double sum;
    while(scanf("%d %lf",&n,&sum)!=EOF)
    {
        memset(t,0,sizeof(t));
        for(int i=0;i<n;i++) scanf("%lf",&t[i]);
        sort(t,t+n);
        double pre=0.0,now=5.0;
        int cnt=0;
        for(int i=0;i<n;i++)
        {
            if(pre<=t[i] && t[i]<=now)
            {
                cnt++;
            }
            else if(t[i]>now)
            {
                while(1)
                {
                    pre+=10.0;
                    now+=10.0;
                    if(t[i]<pre) break;
                    if(pre<=t[i] && t[i]<=now) {i--;break;}//说明接下来的这个点在区间内要i--,否则会漏解
                }
            }
        }
        printf("%.1lf\n",(60+sum*0.2)*(double)cnt);
    }
    return 0;
}
View Code

 

posted @ 2015-08-22 00:40  Cliff Chen  阅读(169)  评论(0编辑  收藏  举报