usaco Transformations
模拟就行。注意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的更多相关文章
- 【USACO】Transformations(模拟)
Transformations A square pattern of size N x N (1 <= N <= 10) black and white square tiles is ...
- 【USACO】Transformations
A square pattern of size N x N (1 <= N <= 10) black and white square tiles is transformed into ...
- Transformations 方块转换 USACO 模拟 数组 数学 耐心
1006: 1.2.2 Transformations 方块转换 时间限制: 1 Sec 内存限制: 128 MB提交: 10 解决: 7[提交] [状态] [讨论版] [命题人:外部导入] 题目 ...
- USACO Section 1.2 Transformations 解题报告
题目 题目描述 一块 N x N正方形的黑白瓦片的图案要被转换成新的正方形图案. 写一个程序来找出将原始图案按照以下列转换方法转换成新图案的最小方式: 转 90 度:图案按顺时针转 90 度. 转 1 ...
- USACO 1.2.2 Transformations 方块转换
Description 一块N x N(1<=N<=10)正方形的黑白瓦片的图案要被转换成新的正方形图案.写一个程序来找出将原始图案按照以下列转换方法转换成新图案的最小方式: 1:转90度 ...
- USACO Section1.2 Transformations 解题报告
transform解题报告 —— icedream61 博客园(转载请注明出处)------------------------------------------------------------ ...
- USACO Section 1.2PROB Transformations
挺有趣的一道题,呵呵,不算难 /* ID: jusonal1 PROG: transform LANG: C++ */ #include <iostream> #include <f ...
- USACO 1.2 Transformations (模拟)
模拟题目,依照题目给定的要求变换图形就可以,变换的优先级依次减小. 这个题目我写的非常乱.只是最还还是勉强能够执行 /* ID:twd30651 PROG:transform LANG:C++ */ ...
- USACO Training Section 1.2 [USACO1.2]方块转换 Transformations
题目描述 一块N x N(1<=N<=10)正方形的黑白瓦片的图案要被转换成新的正方形图案.写一个程序来找出将原始图案按照以下列转换方法转换成新图案的最小方式: 1:转90度:图案按顺时针 ...
随机推荐
- Bootstrap3基础 clearfix pull-left/right 辅助类样式 快速左右浮动
内容 参数 OS Windows 10 x64 browser Firefox 65.0.2 framework Bootstrap 3.3.7 editor ...
- Android 充电信息的获取【转】
本文转载自:https://blog.csdn.net/wateryi/article/details/50834821 在android系统中,电池信息是由BatteryService.java统一 ...
- 给ThinkPad E470C 换个高分屏(1080P)
- UVALive 7503 Change(乱搞)题解
题意:你现在有面额为A的纸币,现在需要面额为B的钱(可以是一张也可以是好多张拼成一张),有一台自动售货机,里面有任意价格的商品,售货机兑换出的零钱是随机的(比如找你0.03可能给你0.01+0.01+ ...
- Elasticsearch查询Index以及删除
查询Index信息 GET /bank HTTP/1.1Host: localhost:9200 { "bank": { "aliases": {}, &quo ...
- Many Website Of WallPaper
我在这里给大家推荐几个不错的壁纸网站 毕竟一张赏心悦目的壁纸能让你的工作效率提高不少 注意前方高能 一大波网站即将来袭 一系列 如你所见 alphacoders wallpaperdj Wallhav ...
- hash进阶:使用字符串hash乱搞的姿势
前言 此文主要介绍hash的各种乱搞方法,hash入门请参照我之前这篇文章 不好意思hash真的可以为所欲为 在开头先放一下题表(其实就是我题解中的hash题目qwq) 查询子串hash值 必备的入门 ...
- 论文笔记:Learning how to Active Learn: A Deep Reinforcement Learning Approach
Learning how to Active Learn: A Deep Reinforcement Learning Approach 2018-03-11 12:56:04 1. Introduc ...
- Java基础 【Arrays 类的使用】
package com.zuoyan.sort; import java.util.Arrays; public class ArraysClassDemo { public static void ...
- 【ASP.NET】System.Web.Routing - StopRoutingHandler Class
Provides a way to specify that ASP.NET routing should not handle requests for a URL pattern. ex: rou ...