• 板块灌水区
  • 楼主yupeishan2012
  • 当前回复1
  • 已保存回复1
  • 发布时间2024/9/16 11:52
  • 上次更新2024/9/16 15:16:31
查看原帖
1285026
yupeishan2012楼主2024/9/16 11:52

为什么!!!为什么会得五十六分!!!P1205

#include <bits/stdc++.h>
using namespace std;

int n;
char a[15][15];
char d[15][15];
char c[15][15];

bool work1(){
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			d[i][j] = a[n - j + 1][i];
		}
	}
	for(int i = 1; i <= n; i++){
		 for(int j = 1; j <= n; j++){
			 if(d[i][j] != c[i][j]) return 0;
		}
	}
	return 1;
}

bool work2(){
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			d[i][j] = a[n - i + 1][n - j + 1];
		}
	}
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			if(d[i][j] != c[i][j]) return 0;
		}
	}
	return 1;
}

bool work3(){
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			d[i][j] = a[j][n - i + 1];
		}
	}
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			if(d[i][j] != c[i][j]) return 0;
		}
	}
	return 1;
}

bool work4(){
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			d[i][j] = a[n - j + 1][i];
		}
	}
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			if(d[i][j] != c[i][j]) return 0;
		}
	}
	return 1;
}

bool work5(){
	work4();
	if(work1()) return 1;
	if(work2()) return 1;
	if(work3()) return 1;
	return 0;
}

bool work6(){
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			if(d[i][j] != c[i][j]) return 0;
		}
	}
	return 1;
}

void work(){
	if(work1()){
		cout << 1;
		return ;
	}
	if(work2()){
		cout << 2;
		return ;
	}
	if(work3()){
		cout << 3;
		return ;
	}
	if(work4()){
		cout << 4;
		return ;
	}
	if(work5()){
		cout << 5;
		return ;
	}
	if(work6()){
		cout << 6;
		return ;
	}
	cout << 7;
}
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];
	}
	work();
	return 0;
}
2024/9/16 11:52
加载中...