ccf 201609-3炉石传说
来源:互联网 发布:h5四川麻将源码 编辑:程序博客网 时间:2024/04/28 02:33
用vector的容器操作会更方便
#include<iostream>#include<string>using namespace std;class servert {public: int h, a; servert(int x, int y) { h = x; a = y; } servert() { h = 0; a = 0; }};servert S[9][2];void join(int f) { int a, b, c; cin >> a >> c >> b; for (int i = 7; i>a; --i) S[i][f] = S[i - 1][f]; S[a][f] = servert(b, c);}void ov(int f, int index) { if (!index) { return; } for (int i = index; i<7; ++i) S[i][f] = S[i + 1][f]; S[7][f].h = 0;}void attack(int f, int d) { int a, b; cin >> a >> b; int f1 = 0, f2 = 0; if (S[a][f].a >= S[b][d].h) f1 = 1; S[b][d].h -= S[a][f].a; if (S[b][d].a >= S[a][f].h) f2 = 1; S[a][f].h -= S[b][d].a; if (f1) ov(d, b); if (f2) ov(f, a);}void pp(int f) { int nu = 0; for (int i = 1; i <= 7; ++i) if (S[i][f].h) ++nu; else break; cout << nu; for (int i = 1; i <= nu; ++i) cout << " " << S[i][f].h; cout << endl;}int main(){ S[0][0].h = S[0][1].h = 30; S[0][0].a=S[0][1].a=0; int n; cin >> n; string str; int a = 0, b = 1; while (n--) { cin >> str; if (str == "summon") join(a); else if (str == "attack") attack(a, b); else swap(a, b); } if (S[0][1].h<=0) cout << 1 << endl; else if (S[0][0].h<=0) cout << -1 << endl; else cout << 0 << endl; cout << S[0][0].h << endl; pp(0); cout << S[0][1].h << endl; pp(1); return 0;}
阅读全文
0 0
- CCF 201609-3 炉石传说
- ccf 201609-3炉石传说
- CCF 201609-3 炉石传说
- 201609-3 炉石传说 ccf
- CCF 201609-3 炉石传说
- CCF 炉石传说
- CCF炉石传说
- ccf 炉石传说
- CCF-炉石传说
- CCF-炉石传说
- CCF炉石传说
- CCF炉石传说
- CCF-炉石传说
- CCF 炉石传说
- ccf炉石传说
- ccf 炉石传说
- ccf 炉石传说
- CCF 201609-3 炉石传说 解题报告 模拟
- 文件读、写、复制
- PCL:使用PCLVisualizer对点云的一些处理
- Spring框架中几个常用概念的理解
- invalid argument
- 导入批量数据一次查询将数据的编码重复的查出来
- ccf 201609-3炉石传说
- PostgreSQL服务器管理:管理数据库
- 身份联盟概念辨析
- Qt中QPainter的问题
- linux-基础-线程
- spring boot 中使用log
- JAVA线程浅见
- Android 实现拍照,选择图片并剪切保存
- kylin count distinct需要注意的东西