3868 - 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 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

似乎看到了熟悉的游戏……飘过~

#include <iostream>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <algorithm>
typedef long long LL;
using namespace std;
int main()
{
    int T,a1,h1,a2,h2;
    cin>>T;
    while(T--)
    {
        cin>>a1>>h1>>a2>>h2;
        if(a1==0)
        {
            cout<<"Invalid"<<endl;
            continue;
        }
        h1-=a2;
        h2-=a1;
        if(h1<=0) cout<<"Discard"<<" ";
        else cout<<a1<<" "<<h1<<" ";
        if(h2<=0) cout<<"Discard"<<endl;
        else cout<<a2<<" "<<h2<<endl;
    }
    return 0;
}

ZOJ 3868 - Earthstone: Easy Version的更多相关文章

  1. Ping-Pong (Easy Version)(DFS)

    B. Ping-Pong (Easy Version) time limit per test 2 seconds memory limit per test 256 megabytes input ...

  2. Codeforces 1077F1 Pictures with Kittens (easy version)(DP)

    题目链接:Pictures with Kittens (easy version) 题意:给定n长度的数字序列ai,求从中选出x个满足任意k长度区间都至少有一个被选到的最大和. 题解:$dp[i][j ...

  3. UVA12569-Planning mobile robot on Tree (EASY Version)(BFS+状态压缩)

    Problem UVA12569-Planning mobile robot on Tree (EASY Version) Accept:138  Submit:686 Time Limit: 300 ...

  4. Coffee and Coursework (Easy version)

    Coffee and Coursework (Easy version) time limit per test 1 second memory limit per test 256 megabyte ...

  5. 2016级算法第六次上机-B.ModricWang's FFT : EASY VERSION

    1114 ModricWang's FFT EASY VERSION 思路 利用FFT做大整数乘法,实际上是把大整数变成多项式,然后做多项式乘法. 例如,对于\(1234\),改写成\(f(x)=1* ...

  6. Saving James Bond - Easy Version (MOOC)

    06-图2 Saving James Bond - Easy Version (25 分) This time let us consider the situation in the movie & ...

  7. Codeforces Round #540 (Div. 3) F1. Tree Cutting (Easy Version) 【DFS】

    任意门:http://codeforces.com/contest/1118/problem/F1 F1. Tree Cutting (Easy Version) time limit per tes ...

  8. Codeforces Round #540 (Div. 3) D1. Coffee and Coursework (Easy version) 【贪心】

    任意门:http://codeforces.com/contest/1118/problem/D1 D1. Coffee and Coursework (Easy version) time limi ...

  9. Codeforces Round #521 (Div. 3) F1. Pictures with Kittens (easy version)

    F1. Pictures with Kittens (easy version) 题目链接:https://codeforces.com/contest/1077/problem/F1 题意: 给出n ...

随机推荐

  1. docker summary

    http://blog.tankywoo.com/docker/2014/05/08/docker-4-summary.html 总结的很好 ----------------------------- ...

  2. leetcode-5 最长回文子串(动态规划)

    题目要求: * 给定字符串,求解最长回文子串 * 字符串最长为1000 * 存在独一无二的最长回文字符串 求解思路: * 回文字符串的子串也是回文,比如P[i,j](表示以i开始以j结束的子串)是回文 ...

  3. c语言的基本语法

    1. 二目运算符从右往左 优先级 运算符 名称或含义 使用形式 结合方向 说明 1 [] 数组下标 数组名[常量表达式] 左到右   () 圆括号 (表达式)/函数名(形参表)   . 成员选择(对象 ...

  4. G面经prepare: Maximum Subsequence in Another String's Order

    求string str1中含有string str2 order的 subsequence 的最小长度 DP做法:dp[i][j]定义为pattern对应到i位置,string对应到j位置时,shor ...

  5. poj1703 Find them, Catch them 并查集

    poj(1703) Find them, Catch them Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 26992   ...

  6. Android设计模式---观察者模式小demo(一)

    1,今天刚好看到了设计模式这一块来,而观察者模式是我一直想总结的,先来看看观察者模式的简单的定义吧 "当一个对象改变时,他的所有依赖者都会受到通知,并自动更新." 一般我们项目中就 ...

  7. highcharts 实例

    <script src="../../Scripts/jquery-1.7.2.min.js" type="text/javascript">< ...

  8. struts2中的ognl详解,摘抄

    http://blog.csdn.net/tjcyjd/article/details/6850203     很全很细致,自己再分析原理进阶

  9. Junit单元测试-环境配置

    JUnit是Java单元测试框架,已经在Eclipse中默认安装.目前主流的有JUnit3和JUnit4.JUnit3中,测试用例需要继承TestCase类.JUnit4中,测试用例无需继承TestC ...

  10. 夺命雷公狗—angularjs—3—表单验证的高级用法

    其实我们的angularjs都是是块状代码,其实是可以在实际开发中保存下来以后就可以达到重复利用的目的了.. 废话不多说,直接上代码: <!doctype html> <html l ...