模拟就行。注意int arr[][]二维数组在定义时是二维数组,而函数传参时是指针。这意味着memset()的不同。传参时只能当作一维逐个memset。

#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cstring>
#include <map>
#include <queue>
#include <set>
#include <cassert>
#define mkp make_pair
using namespace std;
const double EPS=1e-;
const int SZ=,INF=0x7FFFFFFF;
typedef long long lon;
char src[SZ][SZ],dst[SZ][SZ]; void init(char x[SZ][SZ],int n)
{
for(int i=;i<=n;++i)
{
for(int j=;j<=n;++j)cin>>x[i][j];
}
} bool same1(char x[SZ][SZ],char y[SZ][SZ],int n)
{
for(int i=;i<=n;++i)
{
for(int j=;j<=n;++j)
{
if(y[j][n-i+]!=x[i][j])return ;
}
}
return ;
} bool same2(char x[SZ][SZ],char y[SZ][SZ],int n)
{
for(int i=;i<=n;++i)
{
for(int j=;j<=n;++j)
{
if(y[n-i+][n-j+]!=x[i][j])return ;
}
}
return ;
} bool same3(char x[SZ][SZ],char y[SZ][SZ],int n)
{
for(int i=;i<=n;++i)
{
for(int j=;j<=n;++j)
{
if(y[n-j+][i]!=x[i][j])return ;
}
}
return ;
} void getsvd(char dst[SZ][SZ],char src[SZ][SZ],int n)
{
//是指针
for(int i=;i<=n;++i)
memset(dst[i],,sizeof(dst[i]));
for(int i=;i<=n;++i)
{
for(int j=;j<=n;++j)dst[i][j]=src[i][j];
}
for(int i=;i<=n;++i)
{
for(int j=;j<=n/;++j)
{
swap(dst[i][j],dst[i][n-j+]);
}
}
} bool same4(char x[SZ][SZ],char y[SZ][SZ],int n)
{
char svd[SZ][SZ];
//cout<<sizeof(svd)<<endl;
//memset(svd,0,sizeof(svd));
getsvd(svd,x,n);
//return equal(svd+2,svd+3,y+2);
//return equal(svd[1]+1,svd[1]+1+n*12,y[1]+1);
return equal(svd[]+,svd[]+n*,y[]+);
} bool same5(char x[SZ][SZ],char y[SZ][SZ],int n)
{
char svd[SZ][SZ];
getsvd(svd,x,n);
if(same1(svd,y,n))return ;
else if(same2(svd,y,n))return ;
else if(same3(svd,y,n))return ;
else return ;
} bool same6(char x[SZ][SZ],char y[SZ][SZ],int n)
{
return equal(x[]+,x[]+n*,y[]+);
} int main()
{
std::ios::sync_with_stdio();
//freopen("d:\\1.txt","r",stdin);
lon casenum;
//cin>>casenum;
//for(lon time=1;time<=casenum;++time)
{
int n;
cin>>n;
init(src,n),init(dst,n);
if(same1(src,dst,n))cout<<<<endl;
else if(same2(src,dst,n))cout<<<<endl;
else if(same3(src,dst,n))cout<<<<endl;
else if(same4(src,dst,n))cout<<<<endl;
else if(same5(src,dst,n))cout<<<<endl;
else if(same6(src,dst,n))cout<<<<endl;
else cout<<<<endl;
}
return ;
}

usaco Transformations的更多相关文章

  1. 【USACO】Transformations(模拟)

    Transformations A square pattern of size N x N (1 <= N <= 10) black and white square tiles is ...

  2. 【USACO】Transformations

    A square pattern of size N x N (1 <= N <= 10) black and white square tiles is transformed into ...

  3. Transformations 方块转换 USACO 模拟 数组 数学 耐心

    1006: 1.2.2 Transformations 方块转换 时间限制: 1 Sec  内存限制: 128 MB提交: 10  解决: 7[提交] [状态] [讨论版] [命题人:外部导入] 题目 ...

  4. USACO Section 1.2 Transformations 解题报告

    题目 题目描述 一块 N x N正方形的黑白瓦片的图案要被转换成新的正方形图案. 写一个程序来找出将原始图案按照以下列转换方法转换成新图案的最小方式: 转 90 度:图案按顺时针转 90 度. 转 1 ...

  5. USACO 1.2.2 Transformations 方块转换

    Description 一块N x N(1<=N<=10)正方形的黑白瓦片的图案要被转换成新的正方形图案.写一个程序来找出将原始图案按照以下列转换方法转换成新图案的最小方式: 1:转90度 ...

  6. USACO Section1.2 Transformations 解题报告

    transform解题报告 —— icedream61 博客园(转载请注明出处)------------------------------------------------------------ ...

  7. USACO Section 1.2PROB Transformations

    挺有趣的一道题,呵呵,不算难 /* ID: jusonal1 PROG: transform LANG: C++ */ #include <iostream> #include <f ...

  8. USACO 1.2 Transformations (模拟)

    模拟题目,依照题目给定的要求变换图形就可以,变换的优先级依次减小. 这个题目我写的非常乱.只是最还还是勉强能够执行 /* ID:twd30651 PROG:transform LANG:C++ */ ...

  9. USACO Training Section 1.2 [USACO1.2]方块转换 Transformations

    题目描述 一块N x N(1<=N<=10)正方形的黑白瓦片的图案要被转换成新的正方形图案.写一个程序来找出将原始图案按照以下列转换方法转换成新图案的最小方式: 1:转90度:图案按顺时针 ...

随机推荐

  1. Web操作web.config

    1.引用System.Configuration.DLL 2.引用命名空间System.Configuration和System.Web.Configuration 3.上代码 // 使用指定的虚拟路 ...

  2. Python3 tkinter基础 Entry state 不可写 可以选 可复制的输入框

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

  3. cmd copy命令 文件复制【转】

    本文转载自:https://www.jb51.net/article/18981.htm copy,中文含义为“复制”,一个很容易见名知意的命令,它的作用是复制文件,用法十分简单:copy 源文件 目 ...

  4. centos在图形界面和命令行之间切换的快捷键是什么?

    答: ctrl+alt+F1 或者ctrl+alt+F2 1.当前处于图形界面时,按ctrl+alt+F2可进入命令行模式 2. 当前处于命令行模式,按ctrl+alt+F1可进入图形界面

  5. C# 给类做事件的一般做法

    https://docs.microsoft.com/zh-cn/dotnet/standard/events/how-to-raise-and-consume-events 第一个示例演示如何引发和 ...

  6. (转)mblog解读(二)

    (二期)12.开源博客项目mblog解读(二) [课程12]freema...模板.xmind77.9KB [课程12]hibernat...arch.xmind0.1MB freemarker模板技 ...

  7. Java程序运行机制及开发环境

    Java既是编译型语言,又是解释型语言 java源文件首先需要通过javac编译生成后缀名为.class的字节码文件(与平台无关,只面向JVM),然后使用Java虚拟机将字节码解释成特定平台上的机器码 ...

  8. Deep Reinforcement Learning for Visual Object Tracking in Videos 论文笔记

    Deep Reinforcement Learning for Visual Object Tracking in Videos 论文笔记 arXiv 摘要:本文提出了一种 DRL 算法进行单目标跟踪 ...

  9. springmvc上传zip文件并解压缩代码示例

    <input type="file"  id="file"  name="file"> spring中的配置: <!-- ...

  10. 针对list集合进行分页展示

    直接定义个工具类,代码如下: package com.jk51.modules.wechat.web.util; import java.util.Collections; import java.u ...