ZOJ3867:Earthstone: Easy Version

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 <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 long
const double pi = acos(-1.0);
#define Len 100005
#define mod 1000000007

int 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;
}

时间: 2024-10-11 14:26:40

ZOJ3867:Earthstone: Easy Version的相关文章

2016 省热身赛 Earthstone: Easy Version

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 mat

ZOJ 3867 Earthstone: Easy Version

题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3867 题意:跟炉石游戏里的规则也差不多.给你两个小兵 有生命和攻击,问你第一个去攻击第二个的结果. 1 #include <iostream> 2 #include <cstring> 3 #include <string> 4 #include <cstdio> 5 #include <vector> 6 #i

zoj 3867 Earthstone: Easy Version(模拟)

#include<cstdio> #include<iostream> #include<cstring> #include<cmath> #include<stdlib.h> #include<queue> #include<stack> #include<vector> #include<algorithm> #define LL long long using namespace std; c

05-图2. Saving James Bond - Easy Version (25)

05-图2. Saving James Bond - Easy Version (25) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue This time let us consider the situation in the movie "Live and Let Die" in which James Bond, the world's most famous spy, was capture

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

Problem UVA12569-Planning mobile robot on Tree (EASY Version) Accept:138  Submit:686 Time Limit: 3000 mSec  Problem Description  Input The first line contains the number of test cases T (T ≤ 340). Each test case begins with four integers n, m, s, t (

Saving James Bond - Easy Version (MOOC)

06-图2 Saving James Bond - Easy Version (25 分) This time let us consider the situation in the movie "Live and Let Die" in which James Bond, the world's most famous spy, was captured by a group of drug dealers. He was sent to a small piece of land

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 test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given an undirected tree of nn vertices. Some vert

Codeforces Round #575 (Div. 3) D1. RGB Substring (easy version)

Codeforces Round #575 (Div. 3) D1 - RGB Substring (easy version) The only difference between easy and hard versions is the size of the input. You are given a string s consisting of n characters, each character is 'R', 'G' or 'B'. You are also given a

D1. Kirk and a Binary String (easy version)

D1. Kirk and a Binary String (easy version) 01串找最长不降子序列 给定字符串s,要求生成一个等长字符串t,使得任意l到r位置的最长不降子序列长度一致 从后往前暴力枚举,枚举每个一替换成0后是否改变了l到r位置的最长不降子序列长度 01串的最长不降子序列,可以通过线性dp求解 dp i表示以i结尾的最长不降子序列长度 dp[0]=dp[0]+s[i]=='0'; dp[1]=max(dp[0],dp[1])+s[i]=='1'; #include<bi