山东省第七届ACM大学生程序设计竞赛 J题 Execution of Paladin 模拟

题意:

炉石传说:
你有一张法术卡,可以从死亡的鱼人列表里召唤出7张死去的鱼人,当前回合你只有这一张法术卡,现在给你死亡的鱼人列表,和对方英雄的血量,问你一回合内能不能直接干掉他;
死亡的鱼人列表里有4种鱼人:
c:每个玩家再抽两张卡牌
m:所有的鱼人卡片攻击+2,生命+1
b:冲锋,当前回合可以直接攻击
o:冲锋,并且除了他自己有几张鱼人卡片,给自己加几点攻击

分析:

模拟,模拟一遍过程,统计当前回合内可以冲锋的鱼人的攻击力之和,大于对方英雄,输出“Mrghllghghllghg!”,否则,输出“Tell you a joke, the execution of Paladin.”。。
炉石传说—这次校内赛出题最快的两个队,各有一个玩游戏的大神—-本校一队这个题基本最后才提交,读不懂题,理解不了,没有玩过,醉了~~~~

代码:

#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<stdio.h>
#define mod 7
#define Max 1000000000
#define ll long long
using namespace std;
char ch[7][2];
int main()
{

    int t;
    cin >> t;
    while(t--)
    {
        int n,h;
        cin >> n >> h;
        getchar();
        for(int i = 0; i < n; i++)
        {

            char a[25];
            gets(a);
            ch[i][0] = a[0];
            if(ch[i][0] =='B') ch[i][1] = 2;
            if(ch[i][0] =='M') ch[i][1] = 3;
            if(ch[i][0] =='C') ch[i][1] = 2;
            if(ch[i][0] =='O') ch[i][1] = 2;

        }
        for(int i = 0; i < n; i++)
        {
            if(ch[i][0] == 'M')
            {
                for(int i = 0; i < n;i++)
                    ch[i][1] +=2;
            }
            if(ch[i][0] == 'O')
            {
                ch[i][1]+=n-1;
            }
        }
         int sum = 0;
        for(int i = 0; i< n; i++)
        {
            if(ch[i][0] =='B'||ch[i][0] == 'O')
                sum +=ch[i][1];
        }
        //cout << sum <<  endl;
        if(sum>=h)
            cout << "Mrghllghghllghg!" << endl;
        else
            cout << "Tell you a joke, the execution of Paladin." << endl;
    }

    return 0;
}

猜你喜欢

转载自blog.csdn.net/shensiback/article/details/80167395