【CCF】炉石传说 模拟
#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】炉石传说 模拟的更多相关文章
- CCF 炉石传说(模拟)
试题编号: 201612-3 试题名称: 炉石传说 时间限制: 1.0s 内存限制: 256.0MB 问题描述 <炉石传说:魔兽英雄传>(Hearthstone: Heroes of Wa ...
- CCF CSP 201609-3 炉石传说
CCF计算机职业资格认证考试题解系列文章为meelo原创,请务必以链接形式注明本文地址 CCF CSP 201609-3 炉石传说 问题描述 <炉石传说:魔兽英雄传>(Hearthston ...
- CCF2016093炉石传说(C语言版)
问题描述 <炉石传说:魔兽英雄传>(Hearthstone: Heroes of Warcraft,简称炉石传说)是暴雪娱乐开发的一款集换式卡牌游戏(如下图所示).游戏在一个战斗棋盘上进行 ...
- ccf-201609-3 炉石传说
问题描述 <炉石传说:魔兽英雄传>(Hearthstone: Heroes of Warcraft,简称炉石传说)是暴雪娱乐开发的一款集换式卡牌游戏(如下图所示).游戏在一个战斗棋盘上进行 ...
- CSP-201609-3 炉石传说
问题描述 <炉石传说:魔兽英雄传>(Hearthstone: Heroes of Warcraft,简称炉石传说)是暴雪娱乐开发的一款集换式卡牌游戏(如下图所示).游戏在一个战斗棋盘上进行 ...
- [原创]webapp/css3实战,制作一个《炉石传说》宣传页
在移动网页,尤其是webapp中常需要用到大量的css3动画,来获得良好交互体验 我之前帮朋友做了一个,可惜没帮上忙现在和大家分享一下 目标是要做一个<炉石传说>游戏的介绍宣传页面,文字内 ...
- 炉石传说 C# 开发笔记(6月底小结)
炉石传说的开发,已经有30个工作日了. 关于法术的定义方法,有过一次重大的变更:法术效果是整个炉石的核心,正是因为丰富的法术效果,才造就了炉石的可玩性. 原来构思的时候,对于法术效果没有充分的理解,所 ...
- 炉石传说 C# 开发笔记 (续)
炉石传说山寨的工作一直在进行着,在开发过程中深深体会到,对于业务的理解和整个程序的架构的整理远比开发难得多. 在开发过程中,如果你的模型不合理,不准确,很有可能造成代码的混乱,冗余,难以维护和扩展性比 ...
- 炉石传说 C# 开发笔记
最近在大连的同事强力推荐我玩 炉石传说,一个卡牌游戏.加上五一放一个很长很长的假期,为了磨练自己,决定尝试开发一个C#的炉石传说. 这件事情有人已经干过了,开发了一个网页版的炉石,但是貌似不能玩... ...
随机推荐
- PAT (Advanced Level) Practise - 1093. Count PAT's (25)
http://www.patest.cn/contests/pat-a-practise/1093 The string APPAPT contains two PAT's as substrings ...
- How to save console output to a file in Eclipse
https://coderanch.com/t/278299/java/Writing-output-console-file-system File file = new File("te ...
- Nginx高性能web服务器详解书中概要
一.Nginx功能 1.Nginx服务器以其功能丰富著称于世.它既可以作为HTTP服务器,也可以作为反向代理服务器或者邮件服务器;能够快速响应静态页面(HTML)的请求;支持FastCGI.SSL.V ...
- CURLOPT_PROGRESSFUNCTION
Author:李强(李祥祥) Date :2012-12-15 17:26 LIBCURL官方网站都没有说清楚道明白进度函数的参数的作用,这点我感觉文档很片面,经总结如下: size_t CUpl ...
- Vmware 不能上网
Vmware 安装 WIN7 不能上网,如何解决? 情况一: 虚拟机右下角出现红色叉号,检查物理的服务是否开启“VMware NAT Service” 1 .开启方法:WIN + R -> 输入 ...
- 1005: [HNOI2008]明明的烦恼
Time Limit: 1 Sec Memory Limit: 162 MBSubmit: 6539 Solved: 2558[Submit][Status][Discuss] Descripti ...
- 牛客NOIP提高组R1 C保护(主席树)
题意 题目链接 Sol Orz lyq 我们可以把一支军队(u, v)拆分为两个(u, lca)和(v, lca) 考虑一个点x,什么时候军队对它有贡献,肯定是u或v在他的子树内,且lca在他的子树外 ...
- python 输入英语单词,查看汉语意思
# -*- coding:utf-8 -*- import urllib2 import lxml.html as HTML def get_wordmean(): url = 'http://www ...
- linux下安装VMware出错:Gtk-Message: Failed to load module "canberra-gtk-module"解决方法
最近又有兴趣在linux下搭建个虚拟机,于是去找了个VMWorkstation,安装的过程中报了两个错误 Gtk-Message: Failed to load module "pk-gtk ...
- Codeforces Round #460 (Div. 2)-C. Seat Arrangements
C. Seat Arrangements time limit per test1 second memory limit per test256 megabytes Problem Descript ...