#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<map>
#include<vector> using namespace std;
int n;
string cmd;
int now=;
struct node{
int attack;
int health;
node(int _attack,int _health):attack(_attack),health(_health){}
};
vector<node> smn[];
vector<node>::iterator it; void init(){
for(int i=;i<;i++){
smn[i].clear();
smn[i].push_back(node(,));
}
now=;
}
void summon(){
int position,attack,health;
cin>>position>>attack>>health;
it=smn[now].begin();
smn[now].insert(it+position,node(attack,health));
}
void attack(){
int attacker,defender;
cin>>attacker>>defender;
smn[now][attacker].health-=smn[now^][defender].attack;
smn[now^][defender].health-=smn[now][attacker].attack;
for(int i=;i<;i++){
for(it=smn[i].begin()+;it<smn[i].end();it++){
if((*it).health<=){
smn[i].erase(it);
}
}
}
}
void end(){
if(smn[][].health<=&&smn[][].health>){
printf("-1\n");
}else if(smn[][].health>&&smn[][].health>){
printf("0\n");
}else{
printf("1\n");
}
for(int i=;i<;i++){
printf("%d\n",smn[i][].health);
printf("%d",(int)smn[i].size()-);
for(int j=;j<(int)smn[i].size();j++){
printf(" %d ",smn[i][j].health);
}
printf("\n");
} }
int main(){
init();
cin>>n;
while(n--){
cin>>cmd;
if(cmd=="summon"){
summon();
}else if(cmd=="attack"){
attack();
}else if(cmd=="end"){
now^=;
}
}
end();
return ;
}

【CCF】炉石传说 模拟的更多相关文章

  1. CCF 炉石传说(模拟)

    试题编号: 201612-3 试题名称: 炉石传说 时间限制: 1.0s 内存限制: 256.0MB 问题描述 <炉石传说:魔兽英雄传>(Hearthstone: Heroes of Wa ...

  2. CCF CSP 201609-3 炉石传说

    CCF计算机职业资格认证考试题解系列文章为meelo原创,请务必以链接形式注明本文地址 CCF CSP 201609-3 炉石传说 问题描述 <炉石传说:魔兽英雄传>(Hearthston ...

  3. CCF2016093炉石传说(C语言版)

    问题描述 <炉石传说:魔兽英雄传>(Hearthstone: Heroes of Warcraft,简称炉石传说)是暴雪娱乐开发的一款集换式卡牌游戏(如下图所示).游戏在一个战斗棋盘上进行 ...

  4. ccf-201609-3 炉石传说

    问题描述 <炉石传说:魔兽英雄传>(Hearthstone: Heroes of Warcraft,简称炉石传说)是暴雪娱乐开发的一款集换式卡牌游戏(如下图所示).游戏在一个战斗棋盘上进行 ...

  5. CSP-201609-3 炉石传说

    问题描述 <炉石传说:魔兽英雄传>(Hearthstone: Heroes of Warcraft,简称炉石传说)是暴雪娱乐开发的一款集换式卡牌游戏(如下图所示).游戏在一个战斗棋盘上进行 ...

  6. [原创]webapp/css3实战,制作一个《炉石传说》宣传页

    在移动网页,尤其是webapp中常需要用到大量的css3动画,来获得良好交互体验 我之前帮朋友做了一个,可惜没帮上忙现在和大家分享一下 目标是要做一个<炉石传说>游戏的介绍宣传页面,文字内 ...

  7. 炉石传说 C# 开发笔记(6月底小结)

    炉石传说的开发,已经有30个工作日了. 关于法术的定义方法,有过一次重大的变更:法术效果是整个炉石的核心,正是因为丰富的法术效果,才造就了炉石的可玩性. 原来构思的时候,对于法术效果没有充分的理解,所 ...

  8. 炉石传说 C# 开发笔记 (续)

    炉石传说山寨的工作一直在进行着,在开发过程中深深体会到,对于业务的理解和整个程序的架构的整理远比开发难得多. 在开发过程中,如果你的模型不合理,不准确,很有可能造成代码的混乱,冗余,难以维护和扩展性比 ...

  9. 炉石传说 C# 开发笔记

    最近在大连的同事强力推荐我玩 炉石传说,一个卡牌游戏.加上五一放一个很长很长的假期,为了磨练自己,决定尝试开发一个C#的炉石传说. 这件事情有人已经干过了,开发了一个网页版的炉石,但是貌似不能玩... ...

随机推荐

  1. ajax 的 promise

    $.when().done().fail() $.when($.ajax("test1.html"),$.ajax("test2.html")).done(fu ...

  2. Spring Cloud 入门 Eureka-Server服务注册

    这里就不介绍怎么创建springboot项目了,可以查看我前面的博客 Spring Cloud Eureka Spring Cloud Eureka是Spring Cloud Netflix项目下的服 ...

  3. k8s资源配置清单的书写格式(yaml文件)

    yaml文件书写格式:5大类:apiVersion: 选择kubectl api-versions里面存在的版本kind: 选择kubectl api-resources结果中的对象资源metadat ...

  4. Ubuntu 下使用虚拟串口进行开发测试

    1. python 工具 #coding = utf-8 import pty import os import select def mkpty(): master1, slave = pty.op ...

  5. java中常用的swing组件 (2013-10-27-163 写的日志迁移

    五种布局:   流式布局(FlowLayout)边界布局(borderLayout)网格布局(GridLayout)  盒子布局(BoxLaYout)  空布局(null)  常用的几种 卡片布局(C ...

  6. JZOJ 1266. 玉米田

    1266. 玉米田(cowfood.pas/c/cpp) (File IO): input:cowfood.in output:cowfood.out Time Limits: 1000 ms  Me ...

  7. 树莓派下ubuntu-mate中ssh服务的安装与开机后自启动

    ssh程序分为客户端程序openssh-client和服务端程序openssh-server. 如果需要ssh登陆到别的电脑,需要安装openssh-client,该程序ubuntu是默认安装的.而如 ...

  8. 机顶盒demux的工作原理

    在机顶盒中demux部分相对来说是比较复杂的部分,对于机顶盒软件开发的新手来说通常在这里会遇到一些困难,今天特意研究了一下驱动层代码,有一点自己的理解,因此写下来记录一下学习过程. 机顶盒中数据是如何 ...

  9. Building a Space Station POJ - 2031

    Building a Space Station POJ - 2031 You are a member of the space station engineering team, and are ...

  10. 二分法:CF371C-Hamburgers(二分法+字符串的处理)

    Hamburgers Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u    Desc ...