Earthstone is a famous online card game created by Lizard Entertainment. It's a collectible card game that revolves around turn-based matches between, opponents. Players start the game with a substantial collection of basic cards, but can gain rarer and more powerful cards through PU Rchasing packs of additional cards, or as rewards for competing in the arena. Card packs can purchased with gold, a 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 are a one on one turn-based match between and the 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'll be a placed on the table as they is ' summoned ' as minions. Each card has both basic attributes:
- Attack Ai : If A Minion attacks a character or was attacked, it would deal points of damage to the Ai 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 would decrease by the corresponding damage value. The minion would be killed and discarded if it health is less than or equal to zero. If a Minion attacks another minion, both of them would receive damage simultaneously.
Given Minions, please calculate the result if the first minion attacked the second one.
Input
There is multiple test cases. The first line of input contains an integer indicating the number of the T test cases. For each test case:
There is four integers A1 , H1 , A2 and H2 (0 <= A1 , A2 <=10, 1 <= H1 , H2 <=), which Is the attributes of the minions.
Output
For each test case, output "Invalid" (without quotes) if the first Minion cannot attack, otherwise output the Minions attr Ibutes as the format in input. If The minion is killed, output "Discard" instead (without quotes).
Sample Input
33 3 2 43 2 2 50 3 2 2
Sample Output
3 1 2 1Discard 2 2Invalid
Or the sign-in question doesn't explain.
#include <iostream> #include <stdio.h> #include <string.h> #include <stack> #include <queue > #include <map> #include <set> #include <vector> #include <math.h> #include <algorithm >using namespace std, #define LS 2*i#define rs 2*i+1#define up (i,x,y) for (i=x;i<=y;i++) #define DOWN (i,x,y) for (i=x; i>=y;i--) #define MEM (a,x) memset (A,x,sizeof (a)) #define W (a) while (a) #define LL long longconst double pi = acos (-1.0); # Define Len 100005#define mod 1000000007int n,a1,h1,a2,h2;int Main () {scanf ("%d", &n); W (n--) {scanf ("%d%d%d%d", &A1,&H1,&A2,&H2); if (a1<=0) printf ("invalid\n"); else {h1-=a2; H2-=A1; if (h1<=0) printf ("Discard"); else printf ("%d%d", a1,h1); if (h2<=0) printf ("discard\n"); else printf ("%d%d\n", A2,H2); }} return 0;}
ZOJ3867:Earthstone:Easy Version