OJ题目:click here ~~
AC_CODE
int grid[6][6];
int dawuhu()
{
return grid[1][1]&& grid[1][5]&& grid[5][1]&& grid[5][5]&& grid[3][3];
}
int wuhu()
{
int ret = 0;
for(int i = 1;i <= 3;i++)
for(int j = 1;j <= 3;j++)
{
ret += grid[i][j] && grid[i][j+2] && grid[i+1][j+1] && grid[i+2][j] && grid[i+2][j+2] ;
}
return ret;
}
int tongtian()
{
int ret = 0;
for(int i = 1;i <= 5;i++)//横着
{
ret += grid[i][1] && grid[i][2] && grid[i][3] && grid[i][4] && grid[i][5];
}
for(int i = 1;i <= 5;i++)
{
ret += grid[1][i] && grid[2][i] && grid[3][i] && grid[4][i] && grid[5][i];
}
ret += grid[1][1] && grid[2][2] && grid[3][3] && grid[4][4] && grid[5][5];
ret += grid[1][5] && grid[2][4] && grid[3][3] && grid[4][2] && grid[5][1];
return ret;
}
int sixie()
{
int ret = 0;
ret += grid[1][4] && grid[2][3] && grid[3][2] && grid[4][1];
ret += grid[2][1] && grid[3][2] && grid[4][3] && grid[5][4];
ret += grid[2][5] && grid[3][4] && grid[4][3] && grid[5][2];
ret += grid[1][2] && grid[2][3] && grid[3][4] && grid[4][5];
return ret;
}
int sanxie()
{
int ret = 0;
ret += grid[1][3] && grid[2][2] && grid[3][1];
ret += grid[3][1] && grid[4][2] && grid[5][3];
ret += grid[3][5] && grid[4][4] && grid[5][3];
ret += grid[1][3] && grid[2][4] && grid[3][5];
return ret;
}
int xiaodou()
{
int ret = 0;
for(int i = 1;i <= 4;i++)
{
for(int j = 1;j <= 4;j++)
ret += grid[i][j] && grid[i][j + 1] && grid[i+1][j] && grid[i+1][j+1];
}
return ret;
}
int main()
{
//freopen("in.txt","r",stdin);
int t;
cin >> t;
while(t--)
{
string s;
memset(grid , 0 , sizeof(grid));
for(int i = 1;i <= 5;i++)
{
cin >> s;
for(int j = 1;j <= 5;j++)
{
if(s[j - 1] == 'x')
grid[i][j] = 1;
}
}
int ans = 0;
ans += 10*dawuhu();
ans += 5*wuhu();
ans += 5*tongtian();
ans += 4*sixie();
ans += 3*sanxie();
ans += xiaodou();
printf("%d ",ans);
for(int i = 1;i <= 5;i++)
for(int j = 1;j <= 5;j++)
grid[i][j] = 1 - grid[i][j];
ans = 0;
ans += 10*dawuhu();
ans += 5*wuhu();
ans += 5*tongtian();
ans += 4*sixie();
ans += 3*sanxie();
ans += xiaodou();
printf("%d\n",ans);
}
return 0;
}