求助,71分,超级模拟,玄关
查看原帖
求助,71分,超级模拟,玄关
778382
wch666楼主2024/1/12 20:13
#include<bits/stdc++.h>
using namespace std;
int n;
char a[15][15],b[15][15],c[15][15],d[15][15];
bool pd()
{
	for(int i=1; i<=n; i++)
		for(int j=1; j<=n; j++)
			if(b[i][j] != c[i][j])
				return 0;
	return 1;
}
bool work1()
{
	for(int i=1; i<=n; i++)
		for(int j=1; j<=n; j++)
			b[j][n-i+1]=a[i][j];
	return pd();
}
bool work2()
{
	for(int i=1; i<=n; i++)
		for(int j=1; j<=n; j++)
			b[n-i+1][n-j+1]=a[i][j];
	return pd();
}
bool work3()
{
	for(int i=1; i<=n; i++)
		for(int j=1; j<=n; j++)
			b[n-j+1][i]=a[i][j];
	return pd();
}
bool work4()
{
	for(int i=1; i<=n; i++)
		for(int j=1; j<=n; j++)
			b[i][n-j+1]=a[i][j];
	return pd();
}
void fugai()
{
	for(int i=1; i<=n; i++)
		for(int j=1; j<=n; j++)
			a[i][j]=d[i][j];
}
bool work5()
{
	work4();
	fugai();
	if(work1())
		return 1;
	fugai();
	if(work2())
		return 1;
	fugai();
	if(work3())
		return 1;
	return 0;
}
int main()
{
	cin>>n;
	for(int i=1; i<=n; i++)
	{
		for(int j=1; j<=n; j++)
		{
			cin>>a[i][j];
			d[i][j]=a[i][j];
		}
	}
	for(int i=1; i<=n; i++)
		for(int j=1; j<=n; j++)
			cin>>c[i][j];
	if(work1())
		cout<<1;
	else if(work2())
		cout<<2;
	else if(work3())
		cout<<3;
	else if(work4())
		cout<<4;
	else if(work5())
		cout<<5;
	else if(pd())
		cout<<6;
	else
		cout<<7;
	return 0;
}
2024/1/12 20:13
加载中...