《关于蒟蒻打了一个小时却只有53分这件事》
查看原帖
《关于蒟蒻打了一个小时却只有53分这件事》
532686
Zongmingjun楼主2021/10/30 08:34

代码如下,神犇们康康吧

#include<bits/stdc++.h>
#define ll long long
using  namespace std;
char a[15][15],b[15][15],c[15][15];
int n;
void End(){
	#define Fuck return 
	#define CCF 0
}
void first(){
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			c[j][n-i+1]=a[i][j];
		}
	}
}
void third(){
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			c[n-j+1][i]=a[i][j];
		}
	}
}
void second(){
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			c[n-i+1][n-j+1]=a[i][j];
		}
	}
}
void fourth(){
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			c[n-i+1][j]=a[i][j];
		}
	}
}
void fifth_1(){
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			c[j][n-i+1]=c[i][j];
		}
	}
}
void fifth_2(){
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			c[n-i+1][n-j+1]=c[i][j];
		}
	}
}
void fifth_3(){
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			c[n-j+1][i]=a[i][j];
		}
	}
}
void resets(){
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			c[i][j]=a[i][j];
		}
	}
}
bool chk(){
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(b[i][j]!=c[i][j]) return false;
		}
	}
	return true;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++) scanf(" %c",&a[i][j]);
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++) scanf(" %c",&b[i][j]);
	}
	
	if(chk()){
		cout<<6<<endl;
		return 0;
	}
	
	
	resets();
	first();
	if(chk()){
		cout<<1<<endl;
		return 0;
	}
	resets();
	second();
	if(chk()){
		cout<<2<<endl;
		return 0;
	}
	resets();
	third();
	if(chk()){
		cout<<3<<endl;
		return 0;
	}
	resets();
	fourth();
	if(chk()){
		cout<<4<<endl;
		return 0;
	}
	else{
		fifth_1();
		if(chk()){
			cout<<5<<endl;
			return 0;
		}
		else{
			resets();
			fifth_2();
			if(chk()){
				cout<<5<<endl;
				return 0;
			}
			else{
				resets();
				fifth_3();
				if(chk()){
					cout<<5<<endl;
				}
			}
		}
	}
	cout<<7<<endl;
	End();
	Fuck CCF;
}
2021/10/30 08:34
加载中...