• HDU 4461 The Power of Xiangqi (水题)


    题意:给定一些字母,每个字母都代表一值,如果字母中没有B,或者C,那么就在总值大于1的条件下删除1,然后比较大小。

    析:没什么好说的,加起来比较就好了。

    代码如下:

    #pragma comment(linker, "/STACK:1024000000,1024000000")
    #include <cstdio>
    #include <string>
    #include <cstdlib>
    #include <cmath>
    #include <iostream>
    #include <cstring>
    #include <set>
    #include <queue>
    #include <algorithm>
    #include <vector>
    #include <map>
    
    using namespace std ;
    typedef long long LL;
    typedef pair<int, int> P;
    const int INF = 0x3f3f3f3f;
    const double inf = 0x3f3f3f3f;
    const double eps = 1e-8;
    const int maxn = 1e5 + 5;
    const int dr[] = {0, 0, -1, 1};
    const int dc[] = {-1, 1, 0, 0};
    int n, m;
    inline bool is_in(int r, int c){
        return r >= 0 && r < n && c >= 0 && c < m;
    }
    map<char, int> mp;
    
    int main(){
        mp['A'] = 16;
        mp['B'] = 7;
        mp['C'] = 8;
        mp['D'] = 1;
        mp['E'] = 1;
        mp['F'] = 2;
        mp['G'] = 3;
        int T;  cin >> T;
        while(T--){
            scanf("%d", &n);
            char s[5];
            int ans1 = 0, ans2 = 0;
            int h1 = 0, h2 = 0;
            int c1 = 0, c2 = 0;
            for(int i = 0; i < n; ++i){
                scanf("%s", s);
                ans1 += mp[s[0]];
                if(s[0] == 'B')  ++c1;
                else if(s[0] == 'C')  ++h1;
            }
            if(!c1 || !h1){
                if(ans1 > 1)  --ans1;
            }
            scanf("%d", &m);
            for(int i = 0; i < m; ++i){
                scanf("%s", s);
                ans2 += mp[s[0]];
                if(s[0] == 'B')  ++c2;
                else if(s[0] == 'C')  ++h2;
            }
            if(!c2 || !h2){
                if(ans2 > 1)  --ans2;
            }
            if(ans1 > ans2)  puts("red");
            else if(ans1 < ans2)  puts("black");
            else puts("tie");
        }
        return 0;
    }
    
  • 相关阅读:
    cenos7 安装samba
    Cenos7 学习笔记
    mysql学习笔记(一)
    Qt 程序打包发布总结 转
    主机名由localhost变成bogon是怎么回事,怎样变回localhost这个名字?
    Heap Size 与 Stack Size
    数据字节对齐案例
    C语言进阶日志二
    位带操作
    Stm32高级定时器(转自:luowei_memory)
  • 原文地址:https://www.cnblogs.com/dwtfukgv/p/5750585.html
Copyright © 2020-2023  润新知