hdu4461 The Power of Xiangqi【水题】
来源:互联网 发布:mac百度云客户端 编辑:程序博客网 时间:2024/05/21 08:02
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4461
题意:t个样例,没个样例两组输入,每组输入一个n表示有的棋子,接下来输入n个字符(ABCDEFG),每个字符有对应的power,如果当前玩家没有马或者没有炮,玩家的power就-1,问你这两个玩家的power比较情况
解析:把每个人的每个字符的power相加就好,不过要注意-1时是否有本身为0的情况
#include <iostream>#include <algorithm>#include <vector>#include <cstdio>#include <cstring>#include <string>#include <cmath>#include <queue>#include <set>#include <vector>#include <stack>using namespace std;const int maxn = 1e6+100;const int mod = 1000000007;int n,m;int slove(char a){ if(a == 'A') return 16; else if(a == 'B') return 7; else if(a == 'C') return 8; else if(a == 'D') return 1; else if(a == 'E') return 1; else if(a == 'F') return 2; else return 3;}int main(){ int t; cin>>t; while(t--) { int n; scanf("%d",&n); int t1 = 0,t2 = 0; int f1 = 0,f2 = 0; for(int i=0;i<n;i++) { char tmp[3]; scanf("%s",tmp); t1+=slove(tmp[0]); if(tmp[0]=='B') f1++; if(tmp[0]=='C') f2++; } if((!f1||!f2)&&t1>1) t1--; f1 = 0,f2 = 0; scanf("%d",&n); for(int i=0;i<n;i++) { char tmp[3]; scanf("%s",tmp); t2+=slove(tmp[0]); if(tmp[0]=='B') f1++; if(tmp[0]=='C') f2++; } if((!f1||!f2)&&t2>1) t2--; if(t1==t2) puts("tie"); else if(t1>t2) puts("red"); else puts("black"); } return 0;}
0 0
- hdu4461 The Power of Xiangqi【水题】
- HDU4461:The Power of Xiangqi
- hdu4461 The Power of Xiangqi
- HDU4461 The Power of Xiangqi
- 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
- 定时操作之闹钟以及通知
- Android开发 Touch 事件的分发和消费机制
- VBScript调用Excel.Application开发指引
- 经典SQL语句大全
- SVN下载安装及使用教程
- hdu4461 The Power of Xiangqi【水题】
- 移动OA系统在工作中易用性的作用
- 内存管理小样
- Tomcat(一) Tomcat是什么: Tomcat与Java技术 Tomcat与Web应用 以及 Tomcat基本框架及相关配置
- c++POD一句话, 及延伸到 函数
- iOS"离屏渲染"整理总结
- OpenJudge-Noi 1481 Maximum Sum
- Android NuPlayer要点详解
- java web 基础知识(一)