模拟..wa了一次..因为用文件做的..忘了去掉文件了..
而且一开始看错了题...
导致最后改的时候代码乱七八糟的..orz..
#include <iostream>
using namespace std;
char pie_1[6]={'K','Q','R','B','N','P'};
char pie_2[15]={'k','q','r','b','n','p'};
bool hash[18][34];
char ch[18][34];
int main()
{
for (int i=1;i<=17;i++)
for (int j=1;j<=33;j++)
cin>>ch[i][j];
cout<<"White: ";
//find White piece
bool first=false;
memset(hash,0,sizeof(hash));
for (int k=0;k<6;)
{
bool is=false;
for (int i=17;i>=1&&(!is);i--)
{
for (int j=1;j<=33&&(!is);j++)
{
if (hash[i][j]) continue;
if (ch[i][j]==pie_1[k])
{
hash[i][j]=true;
is=true;
if (!first)
{cout<<pie_1[k]<<(char)(j/4+1+96)<<8-i/2+1;first=true;}
else
{
if (k>4) cout<<","<<(char)(j/4+1+96)<<8-i/2+1;
else
cout<<","<<pie_1[k]<<(char)(j/4+1+96)<<8-i/2+1;
}
}
}
}
if (!is) k++;
}
cout<<endl;
first=false;
cout<<"Black: ";
memset(hash,0,sizeof(hash));
for (int k=0;k<6;)
{
bool is=false;
for (int i=1;i<=17&&(!is);i++)
{
for (int j=1;j<=33&&(!is);j++)
{
if (hash[i][j]) continue;
if (ch[i][j]==pie_2[k])
{
hash[i][j]=true;
is=true;
if (k==0)
{ cout<<pie_1[k]<<(char)(j/4+1+96)<<8-i/2+1;first=true;}
else
{
if (k>4) cout<<","<<(char)(j/4+1+96)<<8-i/2+1;
else
cout<<","<<pie_1[k]<<(char)(j/4+1+96)<<8-i/2+1;
}
}
}
}
if (!is) k++;
}
cout<<endl;
return 0;
}