H - 1008


题意:

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 A1H1A2 and H2 (0 <= A1A2 <=10, 1 <= H1H2 <= 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

就是两个人pk,看谁死了!如果有一个人为0,那么无法比赛只能输出“Invalid”,谁赢了输出谁的A i和H i,死了的那个输出“Discard”。

思路:

分解输入两个人的Ai和Hi,然后进行pk,在判断Ai的正负即可!

代码:

#include <iostream>

using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int a1,h1,a2,h2;
        cin>>a1>>h1>>a2>>h2;
        if(a1==0) cout<<"Invalid"<<endl;
        else
        {
            h2=h2-a1;h1=h1-a2;
            if(h1>0&&h2>0) cout<<a1<<" "<<h1<<" "<<a2<<" "<<h2<<endl;
            else if(h2<=0&&h1>0) cout<<a1<<" "<<h1<<" "<<"Discard"<<endl;
            else
            {
                if(h1<=0&&h2>0) cout<<"Discard"<<" "<<a2<<" "<<h2<<endl;
                else if(h1<=0&&h2<=0) cout<<"Discard"<<" "<<"Discard"<<endl;
            }
        }
    }
    return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值