//会重复,所以要除4
#include <bits/stdc++.h>
using namespace std;
char s[10][10];
bool check(int x,int y) {
return x>=1&&y>=1&&x<=9&&y<=9&&s[x][y]=='#';
}
int main() {
for(int i=1;i<=9;i++)
for(int j=1;j<=9;j++)
cin>>s[i][j];
int ans=0;
for(int x1=1;x1<=9;x1++)
for(int y1=1;y1<=9;y1++)
for(int x2=1;x2<=9;x2++)
for(int y2=1;y2<=9;y2++) {
if(x1==x2&&y1==y2)continue;
if(s[x1][y1]=='.'||s[x2][y2]=='.')continue;
int x3=x2-(y2-y1);
int y3=y2-(x1-x2);
int x4=x1-(y2-y1);
int y4=y1-(x1-x2);
if(check(x3,y3)&&check(x4,y4))ans++;
}
cout<<ans/4;
return 0;
}
标签:10,abc,--,int,275,x1
From: https://www.cnblogs.com/basicecho/p/17003181.html