CCF 201612-3炉石传说
来源:互联网 发布:devcpp如何编译java 编辑:程序博客网 时间:2024/04/29 01:14
//@start time://@finish time:/*@此处注意:*//* 测试数据8summon 1 3 6summon 2 4 2endsummon 1 4 5summon 1 2 1attack 1 2endattack 1 17summon 1 3 6summon 2 4 2endsummon 1 4 5summon 1 2 1attack 1 2end*/#include<iostream>#include<cstring>#include<vector>#include<cmath>using namespace std;int main(){int numofline;cin>>numofline;int player=0;vector<vector<int> > slaveA(7,vector<int>(2));vector<vector<int> > slaveB(7,vector<int>(2));int numofA=0,numofB=0;int bloodA=30,bloodB=30;for(int i=0;i<numofline;i++){string tmp;int pos,atk,bld;int pos1,pos2;cin>>tmp;if(tmp[0]=='s'){//summoncin>>pos>>atk>>bld;if(player==0){//A召唤if(numofA>0){for(int j=numofA-1;j>=pos-1;j--){slaveA[j+1][0]=slaveA[j][0];slaveA[j+1][1]=slaveA[j][1]; } }slaveA[pos-1][0]=atk;slaveA[pos-1][1]=bld;numofA++;}if(player==1){//B召唤if(numofB>0){for(int j=numofB-1;j>=pos-1;j--){slaveB[j+1][0]=slaveB[j][0];slaveB[j+1][1]=slaveB[j][1]; } }slaveB[pos-1][0]=atk;slaveB[pos-1][1]=bld;numofB++;}}if(tmp[0]=='a'){//attackcin>>pos1>>pos2;if(player==0){//A attackif(pos2==0){bloodB-=slaveA[pos1-1][0];}else{slaveB[pos2-1][1]-=slaveA[pos1-1][0];slaveA[pos1-1][1]-=slaveB[pos2-1][0];if(slaveB[pos2-1][1]<=0){for(int j=pos2-1;j<numofB-1;j++){slaveB[j][0]=slaveB[j+1][0];slaveB[j][1]=slaveB[j+1][1];}//slaveB[numofB-1][1]=0;//slaveB[numofB-1][0]=0;numofB--;}if(slaveA[pos1-1][1]<=0){for(int j=pos1-1;j<numofA-1;j++){slaveA[j][0]=slaveA[j+1][0];slaveA[j][1]=slaveA[j+1][1];}//slaveA[numofA-1][1]=0;//slaveA[numofA-1][0]=0;numofA--;}}}if(player==1){//B attackif(pos2==0){bloodA-=slaveB[pos1-1][0];}else{slaveA[pos2-1][1]-=slaveB[pos1-1][0];slaveB[pos1-1][1]-=slaveA[pos2-1][0];if(slaveA[pos2-1][1]<=0){ for(int j=pos2-1;j<numofA-1;j++){slaveA[j][0]=slaveA[j+1][0];slaveA[j][1]=slaveA[j+1][1];}//slaveA[numofA-1][1]=0;//slaveA[numofA-1][0]=0;numofA--;}if(slaveB[pos1-1][1]<=0){//slaveB.erase(slaveB.begin()+pos1-1);for(int j=pos1-1;j<numofB-1;j++){slaveB[j][0]=slaveB[j+1][0];slaveB[j][1]=slaveB[j+1][1];}//slaveB[numofB][1]=0;//slaveB[numofB][0]=0;numofB--;}}}}if(tmp[0]=='e'){player=player^1;}/*cout<<"A"<<endl;for(int m=0;m<numofA;m++){cout<<slaveA[m][0]<<" "<<slaveA[m][1]<<endl;}cout<<"B"<<endl;for(int m=0;m<numofB;m++){cout<<slaveB[m][0]<<" "<<slaveB[m][1]<<endl;}*/}if(bloodB<=0) cout<<1<<endl;else if(bloodA<=0) cout<<-1<<endl;else cout<<0<<endl;cout<<bloodA<<endl;cout<<numofA<<" ";for(int i=0;i<numofA;i++){cout<<slaveA[i][1]<<" "; }cout<<endl;cout<<bloodB<<endl;cout<<numofB<<" ";for(int i=0;i<numofB;i++){cout<<slaveB[i][1]<<" ";}cout<<endl;return 0;}
0 0
- CCF 201612-3 炉石传说
- CCF 201612-3炉石传说
- CCF认证 201612-3 炉石传说
- CCF 炉石传说
- CCF炉石传说
- ccf 炉石传说
- CCF-炉石传说
- CCF-炉石传说
- CCF炉石传说
- CCF炉石传说
- CCF-炉石传说
- CCF 炉石传说
- ccf炉石传说
- ccf 炉石传说
- ccf 炉石传说
- CCF 201612-3 炉石传说 JAVA实现
- CCF 201609-3 炉石传说
- ccf 201609-3炉石传说
- LearnOpenGL 1.5 纹理
- ionic 二维码的扫描(包括从本地相册读取和通过摄像头读取)
- Java 中SQL 数据库连接模板写法.
- Longest Common Prefix
- hrbust 2319 Number Game
- CCF 201612-3炉石传说
- 【算法和数据结构】1.2.3–排序算法之插入排序(C++实现)
- python一键分类文件夹下的文件音乐
- 重新实现库函数
- python 爬虫基础学习
- 数据结构哈弗曼树
- java程序员从笨鸟到菜鸟之(七)一—java数据库操作
- 线索二叉树
- 1013. 数素数 (20)