Untitled
unknown
plain_text
a year ago
768 B
2
Indexable
Never
#include <iostream> using namespace std; int main(){ freopen("input.txt","r",stdin); int T; for (T = 0; T < 10; T++){ int N,pal=0; cin>>N; char A[8][8]; int i,j,k; for (i = 0; i < 8; i++) for (j = 0; j < 8; j++) cin>>A[i][j]; for (k = 0; k < 8; k++){ int i,j,dem =0; for (i = 0; i < 8 - N+1; i++){ int d = 0; while (A[k][i+d] == A[k][i+N-d-1] && d <= N/2) d++; if (d == N/2+1) dem ++; } pal = pal+ dem; } for (k = 0; k < 8; k++){ int i,j,dem =0; for (i = 0; i < 8 - N+1; i++){ int d = 0; while (A[i+d][k] == A[i+N-d-1][k] && d <= N/2) d++; if (d == N/2 +1) dem ++; } pal = pal+ dem; } cout<<"#"<<T+1<<" "<<pal<<endl; } return 0; }