求助!(CF应该选择什么语言?)
查看原帖
求助!(CF应该选择什么语言?)
977778
__Harry_Haiyun__楼主2023/9/9 22:36
#include <iostream>
using namespace std;
char c[9][9];
int count(char s)
{
    int cnt = 0;
    for (int i = 0; i < 8; i++)
        for (int j = 0; j < 8; j++)
            if (c[i][j] == s)
                cnt++;
    return cnt;
}
bool eq(int a,int b)
{
    return a == b;
}
int main()
{
    for (int i = 0; i < 8; i++)
        for (int j = 0; j < 8; j++)
            cin >> c[i][j];
    int white = count('Q') * 9 + count('R') * 5 + count('B') * 3 + count('N') * 3 + count('P');
    int black = count('q') * 9 + count('r') * 5 + count('b') * 3 + count('n') * 3 + count('p');
    cout << (!eq(white,black) ? (white > black ? "White" : "Black") : "Draw") << '\n';
    return 0;
}
2023/9/9 22:36
加载中...