hdu(4461) The Power of Xiangqi
2013-09-05 18:55
447 查看
把意思搞清楚很容易给解决了;
注意最后一句话,当马或炮为零时并且sum大于0是sum减一;
#include"stdio.h"#include"string.h"int main(){int sum1,sum2;int k,m,n,a,b;char str[10];scanf("%d",&k);while(k--){scanf("%d",&n);sum1=sum2=0;a=b=0;while(n--){scanf("%s",str);if(str[0]=='A')sum1+=16;else if(str[0]=='B'){sum1+=7;a=1;}else if(str[0]=='C'){sum1+=8;b=1;}else if(str[0]=='D')sum1+=1;else if(str[0]=='E')sum1+=1;else if(str[0]=='F')sum1+=2;else if(str[0]=='G')sum1+=3;}if(sum1>0){if(a==0||b==0)sum1--;}a=b=0;scanf("%d",&m);while(m--){scanf("%s",str);if(str[0]=='A')sum2+=16;else if(str[0]=='B'){sum2+=7;a=1;}else if(str[0]=='C'){sum2+=8;b=1;}else if(str[0]=='D')sum2+=1;else if(str[0]=='E')sum2+=1;else if(str[0]=='F')sum2+=2;else if(str[0]=='G')sum2+=3;}if(sum2>0){if(a==0||b==0)sum2--;}if(sum1==sum2)printf("tie\n");else if(sum1>sum2)printf("red\n");elseprintf("black\n");}return 0;}
相关文章推荐
- hdu 4461 The Power of Xiangqi【模拟】水题
- HDU 4461 The Power of Xiangqi
- hdu 4461 The Power of Xiangqi(水题)
- hdu 4461 The Power of Xiangqi(简单模拟)
- hdu 4461 The Power of Xiangqi(水题)
- HDU 4461 The Power of Xiangqi
- HDU-4461 The Power of Xiangqi 签到题
- HDU 4461 The Power of Xiangqi
- HDU 4461 The Power of Xiangqi 模拟题
- HDU 4461 The Power of Xiangqi 第37届ACM/ICPC杭州赛区I题 (水题)
- HDU-4461-The Power of Xiangqi
- HDU 4461 The Power of Xiangqi(水)
- HDU 4461 The Power of Xiangqi (水题)
- HDU 4461 The Power of Xiangqi
- HDU-#4461 The Power of Xiangqi
- HDU 4461 The Power of Xiangqi(水)
- The Power of Xiangqi(水题)
- HDU4461:The Power of Xiangqi
- The Power of Xiangqi(水题)
- HDU4461 The Power of Xiangqi