【Henu ACM Round#15 A】 A and B and Chess

【链接】 我是链接,点我呀:)
【题意】

在这里输入题意

【题解】

统计大写和小写的个数。 比较答案。输出即可。

【代码】

#include <bits/stdc++.h>
using namespace std;

string s[10];
map<char,int> dic;
int inc[300];

int main()
{
    for (int i = 0;i < 8;i++)
        cin >> s[i];
    for (int i = 0;i < 8;i++)
        for (int j= 0;j < 8;j++)
            if (s[i][j]!='.'){
                dic[s[i][j]]++;
            }
    inc['q']=9;inc['r']=5;inc['b']=3;inc['n']=3;inc['p']=1;

    int a1 = 0;
    for (char i='A';i<='Z';i++){
        a1+=inc[tolower(i)]*dic[i];
    }
    int a2 = 0;
    for (char i='a';i<='z';i++){
        a2+=inc[i]*dic[i];
    }
    if (a1>a2){
        cout<<"White"<<endl;
    }else{
        if (a1==a2){
            cout<<"Draw"<<endl;
        }else{
            cout<<"Black"<<endl;
        }
    }
    return 0;
}
原文地址:https://www.cnblogs.com/AWCXV/p/8350596.html