ccf 炉石传说
来源:互联网 发布:js switch case用法 编辑:程序博客网 时间:2024/06/09 16:35
考试的时候写了现在两倍长的代码却只得了60分。〒▽〒〒▽〒〒▽〒。这题没有什么东西细心一点就行了。
#include<bits/stdc++.h>using namespace std;typedef struct{ int t,h;}S;S s[2][10];int main(){s[0][0].h=30;s[1][0].h=30;int n,a,b,d;int cnt;char c[20];scanf("%d",&n);S temp;int flag=0;while(n--){scanf("%s",c);if(strcmp(c,"summon")==0){scanf("%d %d %d",&a,&b,&d);temp.t=b,temp.h=d;for(int i=6;i>=a;i--){s[flag%2][i+1]=s[flag%2][i];}s[flag%2][a]=temp;}if(strcmp(c,"attack")==0){scanf("%d %d",&a,&b);S t1=s[flag%2][a];S t2=s[(flag+1)%2][b];s[flag%2][a].h-=t2.t;if(s[flag%2][a].h<=0){for(int i=a;i<=6;i++)s[flag%2][i]=s[flag%2][i+1];}s[(flag+1)%2][b].h-=t1.t;if(s[(flag+1)%2][b].h<=0&&b!=0){for(int i=b;i<=6;i++)s[(flag+1)%2][i]=s[(flag+1)%2][i+1];}}if(strcmp(c,"end")==0)flag++;}cnt=0;if(s[0][0].h<=0)printf("-1\n");else if(s[1][0].h<=0)printf("1\n");else printf("0\n");printf("%d\n",s[0][0].h);for(int i=1;i<=7;i++){if(s[0][i].h>0)cnt++;}printf("%d ",cnt);for(int i=1;i<=cnt;i++)printf("%d ",s[0][i].h);printf("\n");cnt=0;printf("%d\n",s[1][0].h);for(int i=1;i<=7;i++)if(s[1][i].h>0)cnt++;printf("%d ",cnt);for(int i=1;i<=cnt;i++)printf("%d ",s[1][i].h);}
0 0
- CCF 炉石传说
- CCF炉石传说
- ccf 炉石传说
- CCF-炉石传说
- CCF-炉石传说
- CCF炉石传说
- CCF炉石传说
- CCF-炉石传说
- CCF 炉石传说
- ccf炉石传说
- ccf 炉石传说
- ccf 炉石传说
- CCF 炉石传说 <模拟>
- 炉石传说-CCF往届题
- ccf试题 炉石传说
- ccf 炉石传说 模拟
- CCF 201609-3 炉石传说
- CCF 201612-3 炉石传说
- 安卓 本地服务和远程服务
- Canada Cup 2016 D. Contest Balloons
- 根据大图获得缩略图
- 2016 Git 教程 从入门到精通(一)
- 使用SOCKET实现TCP/IP协议的通讯
- ccf 炉石传说
- PHP基础——Include、require、include_once、require_once区别。
- 个人微信机器人
- LeetCode ---- Find the Difference (Java/Lua 实现)
- Mac上CocosCreator1.2.1打包andoird apk
- C#之使用RichTextBox 实现简单的txt编辑器
- Eclipse 安装最新SVN插件
- Android中子线程真的不能更新UI吗?
- centos6.6 升级mysql到5.5 ,因为默认是5.1