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 ...
随机推荐
- BZOJ——1571: [Usaco2009 Open]滑雪课Ski
http://www.lydsy.com/JudgeOnline/problem.php?id=1571 Time Limit: 10 Sec Memory Limit: 64 MBSubmit: ...
- 树莓派LED指示灯说明
原文:http://shumeipai.nxez.com/2014/09/30/raspberry-pi-led-status-detail.html?variant=zh-cn LED亮灯状态 LE ...
- 某考试 T1 line
状压dp+矩阵转移,据说正解是dfs出的合法状态,,但难道不是三个for就行了吗2333 #include<iostream> #include<cmath> #include ...
- java实现简单的算法
排序大的分类可以分为两种:内排序和外排序.在排序过程中,全部记录存放在内存,则称为内排序,如果排序过程中需要使用外存,则称为外排序.下面讲的排序都是属于内排序. 内排序有可以分为以下几类: (1).插 ...
- spring启动时加载字典表数据放入map
import java.util.HashMap; import java.util.List; import org.springframework.beans.factory.annotation ...
- linux驱动开发流程
嵌入式linux驱动开发流程嵌入式系统中,操作系统是通过各种驱动程序来驾驭硬件设备的.设备驱动程序是操作系统内核和硬件设备之间的接口,它为应用程序屏蔽了硬件的细节,这样在应用程序看来,硬件设备只是一个 ...
- 【转】 nginx rewrite 伪静态配置参数详细说明
nginx rewrite 伪静态配置参数和使用例子 附正则使用说明 正则表达式匹配,其中: * ~ 为区分大小写匹配 * ~* 为不区分大小写匹配 * !~和!~*分别为区分大小写不匹配及不区分 ...
- 转:为什么Uber宣布从Postgres切换到MySQL?
转: http://mp.weixin.qq.com/s?__biz=MzAwMDU1MTE1OQ==&mid=2653547609&idx=1&sn=cbb55ee823dd ...
- 谷歌訪问之直接输入ip地址
废话啥说.直接上IP: 173.194.121.51 173.194.43.19 173.194.65.147 74.125.235.148
- JNI——访问数组
JNI在处理基本类型数组和对象数组上面是不同的.对象数组里面是一些指向对象实例或者其它数组的引用. 因为速度的原因,先通过GetXXXArrayElements函数把简单类型的数组转化成本地类型的数组 ...