HDU 4461 The Power of Xiangqi 模拟题
2013-05-28 19:12
447 查看
解题报告:
题目大意:现有两个人在下中国象棋,给出一种局面,问谁的攻击力更大,通过判断双方持有的子的总的分数加起来,看谁的分数更大,每个棋子有一个对应的分数。
模拟题,要注意的是题目中有说明,炮和马是绝配,当哪一方一个马都没有或者一个炮或者两种都没有的 话,那么它的攻击力要减少1。
View Code
题目大意:现有两个人在下中国象棋,给出一种局面,问谁的攻击力更大,通过判断双方持有的子的总的分数加起来,看谁的分数更大,每个棋子有一个对应的分数。
模拟题,要注意的是题目中有说明,炮和马是绝配,当哪一方一个马都没有或者一个炮或者两种都没有的 话,那么它的攻击力要减少1。
#include<cstdio> #include<cmath> int score[8]={16,7,8,1,1,2,3}; int main() { int T,n,score1,score2; char ch[5]; scanf("%d",&T); while(T--) { score1=score2=0; scanf("%d",&n); int flag=0; while(n--) { scanf("%s",ch); if(ch[0]=='B'||ch[0]=='C') flag++; score1+=score[ch[0]-'A']; } if(flag<2) score1--; scanf("%d",&n); flag=0; while(n--) { scanf("%s",ch); if(ch[0]=='B'||ch[0]=='C') flag++; score2+=score[ch[0]-'A']; } if(flag<2) score2--; if(score1>score2) printf("red\n"); else if(score1<score2) printf("black\n"); else printf("tie\n"); } return 0; }
View Code
相关文章推荐
- 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(水题)
- 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(水)
- 【杭州赛区现场赛PROBLEM I】阅读理解与模拟-The Power of Xiangqi
- HDU 4028 The time of a day STL 模拟题
- hdu4461 The Power of Xiangqi【水题】
- hdu4461 The Power of Xiangqi