挺有趣的一道题,呵呵,不算难

/*
ID: jusonal1
PROG: transform
LANG: C++
*/
#include <iostream>
#include <fstream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <map>
#include <cstring>
using namespace std;
const int maxn = 15;
int n;
struct MP{
char mp[maxn][maxn];
};
MP orign_map;
MP then_map;
MP new_map;
bool pattern_1(const MP a){
for(int i = 1;i <= n;++i)
for(int j = 1;j <= n;++j)
if(then_map.mp[i][j] != a.mp[n-j+1][i])
return false;
return true;
}
bool pattern_2(const MP a){
for(int i = 1;i <= n;++i)
for(int j = 1;j <= n;++j)
if(then_map.mp[i][j] != a.mp[n-i+1][n-j+1])
return false;
return true;
}
bool pattern_3(MP a){
for(int i = 1;i <= n;++i)
for(int j = 1;j <= n;++j)
if(then_map.mp[i][j] != a.mp[j][n-i+1])
return false;
return true;
}
bool pattern_4(MP a){
for(int i = 1;i <= n;++i)
for(int j = 1;j <= n;++j)
if(then_map.mp[i][j] != a.mp[i][n-j+1])
return false;
return true;
}
bool pattern_5(MP a){
if(pattern_1(a)) return true;
if(pattern_2(a)) return true;
if(pattern_3(a)) return true;
return false;
}
bool pattern_6(MP a){
for(int i = 1;i <= n;++i)
for(int j = 1;j <= n;++j)
if(a.mp[i][j] != then_map.mp[i][j]) return false;
return true;
}
void print(){
for(int i = 1;i <= n;++i){
for(int j = 1;j <= n;++j)
printf("%c",new_map.mp[i][j]);
puts("");
}
puts("");
}
void getmap(){
for(int i = 1;i <= n;++i)
for(int j = 1;j <= n;++j)
scanf(" %c",&orign_map.mp[i][j]);
for(int i = 1;i <= n;++i)
for(int j = 1;j <= n;++j)
scanf(" %c",&then_map.mp[i][j]);
return ;
}
int main () {
freopen("transform.in","r",stdin);
freopen("transform.out","w",stdout);
scanf("%d",&n);
getmap();
MP new_map;
for(int i = 1;i <= n;++i)
for(int j = 1;j <= n;++j)
new_map.mp[i][j] = orign_map.mp[i][n-j+1];
if(pattern_1(orign_map)) puts("1");
else if(pattern_2(orign_map)) puts("2");
else if(pattern_3(orign_map)) puts("3");
else if(pattern_4(orign_map)) puts("4");
else if(pattern_5(new_map)) puts("5");
else if(pattern_6(orign_map))puts("6");
else puts("7");
return 0;
}

最新文章

  1. 分布式搜索引擎Elasticsearch性能优化与配置
  2. Linux简介及常用命令使用3--vi编辑器
  3. ListView用法总结
  4. (视频)《快速创建网站》 4.2 完结篇 – 应用运营vs.发射卫星,遥测(Telemetry) 技术
  5. 拆分Spring配置文件
  6. Ubuntu下安装php调试工具xdebug
  7. DIY常用网站
  8. DRP总结
  9. ntity Framework技巧系列之四 - Tip 13 – 15
  10. Tomcat配置远程调试端口
  11. 原生JS实现淘宝无缝轮播
  12. Java经典编程题50道之二十三
  13. Python基础学习(第一周)
  14. shardingsphere多数据源(springboot + mybatis+shardingsphere+druid)
  15. 从零开始一起学习SLAM | 学习SLAM到底需要学什么?
  16. 转JMeter ----数据库 not allowed to connect to this MySQL
  17. java 二分法
  18. [CF1027F]Session in BSU[最小基环树森林]
  19. TCP源码—epoll源码及测试
  20. SaltStack日常维护-第七篇

热门文章

  1. http返回状态码错误
  2. LAMP中添加多虚拟主机
  3. Python之禅 吾心笃定
  4. python爬虫入门01:教你在 Chrome 浏览器轻松抓包
  5. selenium3 简单使用
  6. 09-看图理解数据结构与算法系列(B树)
  7. selenium IDE脚本编辑与操作
  8. intellij idea 忽略文件不提交
  9. Leetcode 211.添加与搜索单词
  10. Quartz.net框架使用