【CS Round #46 (Div. 1.5) B】Letters Deque
【链接】h在这里写链接
【题意】
让你把一个正方形A竖直或水平翻转。
问你翻转一次能不能把A翻转成B
【题解】
有说一定要恰好为1次。
并不是说A和B相同就一定不行。
【错的次数】
2
【反思】
自己强行理解错题意
【代码】
/*
*/
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <cstdlib>
#include <cmath>
#include <bitset>
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define mp make_pair
#define pb emplace_back
#define fi first
#define se second
#define ld long double
#define ms(x,y) memset(x,y,sizeof x)
#define ri(x) scanf("%d",&x)
#define rl(x) scanf("%lld",&x)
#define rs(x) scanf("%s",x)
#define rf(x) scnaf("%lf",&x)
#define oi(x) printf("%d",x)
#define ol(x) printf("%lld",x)
#define oc putchar(' ')
#define os(x) printf(x)
#define all(x) x.begin(),x.end()
#define Open() freopen("F:\\rush.txt","r",stdin)
#define Close() ios::sync_with_stdio(0)
#define sz(x) ((int) x.size())
#define ld long double
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;
//mt19937 myrand(time(0));
//int get_rand(int n){return myrand()%n + 1;}
const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
const double pi = acos(-1.0);
const int N = 110;
int n,a[N+10][N+10],b[N+10][N+10];
bool ok(){
rep1(i,1,n)
rep1(j,1,n)
if (a[i][j]!=b[i][j]){
return false;
}
return true;
}
void shui(){
rep1(i,1,n/2)
rep1(j,1,n)
swap(a[i][j],a[n-i+1][j]);
}
void shu(){
rep1(j,1,n/2){
rep1(i,1,n)
swap(a[i][j],a[i][n-j+1]);
}
}
int main(){
//Open();
//Close();
ri(n);
rep1(i,1,n)
rep1(j,1,n)
ri(a[i][j]);
rep1(i,1,n)
rep1(j,1,n)
ri(b[i][j]);
shui();
if (ok()){
puts("1");
return 0;
}
shui();
shu();
if (ok()){
puts("1");
return 0;
}
puts("0");
return 0;
}

浙公网安备 33010602011771号