1. 程式人生 > >【Henu ACM Round#15 A】 A and B and Chess

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

space hit bit def ace pos 答案 clu cpp

【鏈接】 我是鏈接,點我呀:)
【題意】


在這裏輸入題意

【題解】


統計大寫和小寫的個數。
比較答案。輸出即可。

【代碼】

#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; }

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