Transformations
分析:根据操作模拟
/*
ID:wanghan
PROB:transform
LANG:C++
*/
#include "iostream"
#include "cstdio"
#include "cstring"
#include "string"
#include "cmath"
using namespace std;
const int maxn=;
string s[maxn],solve[maxn];
int n;
bool Turn3(string str[],string val[]){
char t[maxn][maxn];
for(int i=;i<n;i++){
for(int j=;j<n;j++){
t[i][j]=s[j][n--i];
}
}
/*for(int i=0;i<n;i++){
for(int j=0;j<n;j++)
cout<<t[i][j];
cout<<endl;
}
cout<<endl;*/
int flag=;
for(int i=;i<n;i++){
for(int j=;j<n;j++)
if(t[i][j]!=val[i][j]){
flag=; break;
}
if(flag) break;
}
if(flag) return false;
return true;
}
bool Turn2(string str[],string val[]){
char t[maxn][maxn];
for(int i=;i<n;i++){
for(int j=;j<n;j++)
t[i][j]=str[n-i-][n-j-];
}
/*for(int i=0;i<n;i++){
for(int j=0;j<n;j++)
cout<<t[i][j];
cout<<endl;
}
cout<<endl;*/
int flag=;
for(int i=;i<n;i++){
for(int j=;j<n;j++)
if(t[i][j]!=val[i][j]){
flag=; break;
}
if(flag) break;
}
if(flag) return false;
return true;
}
bool Turn1(string str[],string val[]){
char t[maxn][maxn];
for(int i=;i<n;i++){
for(int j=;j<n;j++)
t[i][j]=str[n--j][i];
}
/*for(int i=0;i<n;i++){
for(int j=0;j<n;j++)
cout<<t[i][j];
cout<<endl;
}
cout<<endl;*/
int flag=;
for(int i=;i<n;i++){
for(int j=;j<n;j++)
if(t[i][j]!=val[i][j]){
flag=; break;
}
if(flag) break;
}
if(flag) return false;
return true;
}
bool Turn4(string str[],string val[]){
for(int i=;i<n;i++){
for(int j=;j<n/;j++)
swap(str[i][j],str[i][n--j]);
}
/*for(int i=0;i<n;i++){
for(int j=0;j<n;j++)
cout<<str[i][j];
cout<<endl;
}
cout<<endl;*/
int flag=;
for(int i=;i<n;i++){
for(int j=;j<n;j++)
if(str[i][j]!=val[i][j]){
flag=; break;
}
if(flag) break;
}
if(flag) return false;
return true;
}
bool Turn5(string str[],string val[]){
char t1[maxn][maxn],t2[maxn][maxn],t3[maxn][maxn];
/*for(int i=0;i<n;i++){
for(int j=0;j<n/2;j++)
swap(str[i][j],str[i][n-1-j]);
}*/
for(int i=;i<n;i++){
for(int j=;j<n;j++)
t1[i][j]=str[n--j][i];
}
int flag=;
for(int i=;i<n;i++){
for(int j=;j<n;j++)
if(t1[i][j]!=val[i][j]){
flag=; break;
}
if(flag) break;
}
if(!flag) return true;
/*for(int i=0;i<n;i++){
for(int j=0;j<n;j++)
cout<<t1[i][j];
cout<<endl;
}
cout<<endl;*/
for(int i=;i<n;i++){
for(int j=;j<n;j++)
t2[i][j]=str[n-i-][n-j-];
}
flag=;
for(int i=;i<n;i++){
for(int j=;j<n;j++)
if(t2[i][j]!=val[i][j]){
flag=; break;
}
if(flag) break;
}
if(!flag) return true;
/*for(int i=0;i<n;i++){
for(int j=0;j<n;j++)
cout<<t2[i][j];
cout<<endl;
}
cout<<endl;*/
for(int i=;i<n;i++){
for(int j=;j<n;j++){
t3[i][j]=str[j][n--i];
}
}
//int flag=0;
flag=;
for(int i=;i<n;i++){
for(int j=;j<n;j++)
if(t3[i][j]!=val[i][j]){
flag=; break;
}
if(flag) break;
}
/*for(int i=0;i<n;i++){
for(int j=0;j<n;j++)
cout<<t3[i][j];
cout<<endl;
}
cout<<endl;*/
if(!flag) return true;
return false;
}
bool Turn6(string str[],string val[]){
int flag=;
for(int i=;i<n;i++){
for(int j=;j<n;j++)
if(str[i][j]!=val[i][j]){
flag=; break;
}
if(flag) break;
}
if(flag) return false;
return true;
}
int main()
{
freopen("transform.in", "r", stdin);
freopen("transform.out", "w", stdout);
while(cin>>n){
for(int i=;i<n;i++){
cin>>s[i];
}
for(int i=;i<n;i++){
cin>>solve[i];
}
if(Turn1(s,solve)){
cout<<""<<endl;
}else if(Turn2(s,solve)){
cout<<""<<endl;
}else if(Turn3(s,solve)){
cout<<""<<endl;
}else if(Turn4(s,solve)){
cout<<""<<endl;
}else if(Turn5(s,solve)){
cout<<""<<endl;
}else if(Turn6(s,solve)){
cout<<""<<endl;
}else{
cout<<""<<endl;
}
}
return ;
}
Transformations的更多相关文章
- [大数据之Spark]——Transformations转换入门经典实例
Spark相比于Mapreduce的一大优势就是提供了很多的方法,可以直接使用:另一个优势就是执行速度快,这要得益于DAG的调度,想要理解这个调度规则,还要理解函数之间的依赖关系. 本篇就着重描述下S ...
- 【USACO】Transformations(模拟)
Transformations A square pattern of size N x N (1 <= N <= 10) black and white square tiles is ...
- WPF Wonders: Transformations (and Robots!)
indows Presentation Framework (WPF) gets a lot of mileage out of being layered on top of DirectX, in ...
- [Compose] 21. Apply Natural Transformations in everyday work
We see three varied examples of where natural transformations come in handy. const Right = x => ( ...
- [Compose] 20. Principled type conversions with Natural Transformations
We learn what a natural transformation is and see the laws it must obey. We will see how a natural t ...
- Glossary of view transformations
Glossary of view transformations The following terms are used to define view orientation, i.e. trans ...
- 【USACO】Transformations
A square pattern of size N x N (1 <= N <= 10) black and white square tiles is transformed into ...
- [USACO1.2.2]方块转换 Transformations
P1205 [USACO1.2]方块转换 Transformations 标签 搜索/枚举 USACO 题目描述 一块N x N(1<=N<=10)正方形的黑白瓦片的图案要被转换成新的正方 ...
- SSIS 阻塞,半阻塞和全阻塞 (Non-blocking, semi-blocking and Fully-blocking) transformations清单
三种Blocking类型,这里跟数据流的Buff关系很大:■■ non-blocking transformations,每一行直接转换输出,没有等待.■■ partial-blocking tran ...
- spark的action和transformations汇集
汇总了Spark支持的Transformations 和Actions 用于备忘! 參考 http://spark.apache.org/docs/latest/programming-guide.h ...
随机推荐
- rsync同步文件
rsync中的参数 -r 是递归 -l 是链接文件,意思是拷贝链接文件:-p 表示保持文件原有权限:-t 保持文件原有时间:-g 保持文件原有用户组:-o 保持文件原有属主:-D 相当于块设备文件: ...
- Codeforces 667D World Tour【最短路+枚举】
垃圾csdn,累感不爱! 题目链接: http://codeforces.com/contest/667/problem/D 题意: 在有向图中找到四个点,使得这些点之间的最短距离之和最大. 分析: ...
- BZOJ 2957 楼房重建 (线段树)
题目链接 楼房重建 解题思路:我们可以把楼房的最高点的斜率计算出来.那么问题就转化成了实时查询x的个数,满足数列x的左边没有大于等于x的数. 我们可以用线段树维护 设t[i]为如果只看这个区间,可以 ...
- 快速掌握RabbitMQ(四)——两种消费模式和QOS的C#实现
本篇介绍一下RabbitMQ中的消费模式,在前边的所有栗子中我们采用的消费者都是EventingBasicConsumer,其实RabbitMQ中还有其他两种消费模式:BasicGet和QueueBa ...
- SSH login without password
SSH login without password Your aim You want to use Linux and OpenSSH to automize your tasks. Theref ...
- CSS3 animation(动画) 属性
一.animation 1.CSS3 animation(动画) 属性 语法: animation: name duration timing-function delay iteration-cou ...
- java栈、堆
一.栈.堆 几个小概念 1.寄存器:最快的存储区, 由编译器根据需求进行分配,我们在程序中无法控制. 2. 栈:存放基本类型的变量数据和对象的引用,但对象本身不存放在栈中,而是存放在堆(new 出来的 ...
- windows下安装elasticsearch6.2.4
window 下安装 elasticsearch 一.环境搭建需要的环境 1.jdk环境 2.Elasticsearch 3.git 环境 4.node 安装包 二.进行环境的搭建 1.解压Ela ...
- 安装Sublime配合quick-cocos2d-x开发
下载地址 Sublime下载地址 安装 Package Control 在Sublime中,按Ctrl+~打开控制台,输入: Sublime Text2 import urllib2,os; pf=' ...
- eclipse无法启动问题记录
几天没开eclipse,居然报错“can not unload……”,搜索答案发现没有准确的,遵从了一个多人顶赞的办法重下eclipse,把配置文件拷贝一份,结果悲剧了,虽然能够打开了,但我之前配置的 ...