HDU-4461 The Power of Xiangqi 签到题
2013-05-29 21:42
323 查看
题意:要求计算两个和值比较大小。注意没有马或者是炮的时候能量减1,且能量不能小于1。
代码如下:
代码如下:
#include <cstdlib> #include <cstdio> #include <cstring> #include <algorithm> #include <iostream> using namespace std; int table[10] = {16, 7, 8, 1, 1, 2, 3}; int main() { int T; scanf("%d", &T); while (T--) { int x, y, sa = 0, sb = 0; char str[5]; int m = 0, p = 0; scanf("%d", &x); for (int i = 0; i < x; ++i) { scanf("%s", str); sa += table[str[0]-'A']; if (str[0]-'A' == 1) m = 1; if (str[0]-'A' == 2) p = 1; } if (!m || !p) sa = max(1, sa - 1); m = p = 0; scanf("%d", &y); for (int i = 0; i < y; ++i) { scanf("%s", str); sb += table[str[0]-'A']; if (str[0]-'A' == 1) m = 1; if (str[0]-'A' == 2) p = 1; } if (!m || !p) sb = max(1, sb - 1); if (sa == sb) { puts("tie"); } else { puts(sa > sb ? "red" : "black"); } } 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
- 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----(5053)the Sum of Cube(签到题,水体)
- HDU4461:The Power of Xiangqi
- The Power of Xiangqi(水题)
- The Power of Xiangqi(水题)