码迷,mamicode.com
首页 > 其他好文 > 详细

2016 省热身赛 Earthstone: Easy Version

时间:2016-05-03 00:34:55      阅读:199      评论:0      收藏:0      [点我收藏+]

标签:

Earthstone: Easy Version
Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu
 

Description

Earthstone is a famous online card game created by Lizard Entertainment. It is a collectible card game that revolves around turn-based matches between two opponents. Players start the game with a substantial collection of basic cards, but can gain rarer and more powerful cards through purchasing packs of additional cards, or as rewards for competing in the arena. Card packs can be purchased with gold, an in-game currency rewarded for completing random daily quests and winning matches, or by using real money in the in-game store.

技术分享

Each Earthstone battle is a one on one turn-based match between two opponents. During a player‘s turn, he can choose to play any of his cards and command the minions to attack targets. Those played cards will be placed on the table as they are ‘summoned‘ as minions. Each card has two basic attributes:

 

  • Attack Ai: If a minion attacks a character or was attacked, it will deal Ai points of damage to the opponent. A character whose attack value is zero cannot actively attack.
  • Health Hi: The minion has Hi points of initial health. After being damaged, the minion‘s health will decrease by the corresponding damage value. The minion will be killed and discarded if its health is less than or equal to zero.
  • If a minion attacks another minion, both of them will receive damage simultaneously.

 

Given two minions, please calculate the result if the first minion attacked the second one.

Input

There are multiple test cases. The first line of input contains an integer T indicating the number of test cases. For each test case:

There are four integers A1, H1, A2 and H2 (0 <= A1, A2 <=10, 1 <= H1, H2 <= 10), which are the attributes of two minions.

Output

For each test case, output "Invalid" (without quotes) if the first minion cannot attack, otherwise output the minions attributes as the format in input. If the minion is killed, output "Discard" instead (without quotes).

Sample Input

3
3 3 2 4
3 2 2 5
0 3 2 2

Sample Output

3 1 2 1
Discard 2 2
Invalid

水题一个
# include <iostream>
using namespace std;
int main()
{
    int t;
    cin >> t;
    int a1, h1, a2, h2;
    while(t--)
    {
        cin >> a1 >> h1 >> a2 >> h2;
        if(a1 == 0)
        {
            cout << "Invalid" << endl;
            continue;
        }
        h1 = h1 - a2;
        h2 = h2 - a1;
        if(h1 > 0)
        {
            cout << a1 << " " << h1;
        }
        else
        {
            cout << "Discard";
        }
        cout << " ";
        if(h2 > 0)
        {
            cout << a2 << " " << h2;
        }
        else
        {
            cout << "Discard";
        }
        cout << endl;
    }

    return 0;
}

 

 

2016 省热身赛 Earthstone: Easy Version

标签:

原文地址:http://www.cnblogs.com/lyf-acm/p/5453493.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!