Codeforces Round #243 (Div. 2) Problem B - Sereja and Mirroring 解读

时间:2022-10-21 14:32:14

http://codeforces.com/contest/426/problem/B

对称标题的意思大概是。应当指出的,当线数为奇数时,答案是线路本身的数

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define maxn 1005
using namespace std; char a[maxn][maxn];
int ans; void solve(int r)
{
if(r % 2)
return; for(int i = 1, j = r; i <= r / 2; i ++, j --)
{
if(strcmp(a[i], a[j]))
return;
} ans /= 2;
solve (r / 2);
} int main()
{
int row, lie; scanf("%d%d", &row, &lie);
getchar(); int i;
for(i = 1; i <= row; i ++)
{
gets(a[i]);
// cout << i << endl;
} ans = row;
solve(row); cout << ans << endl;
return 0;
}

版权声明:本文博客原创文章。博客,未经同意,不得转载。