usaco Transformations 模拟模拟模拟 ,惨不忍睹

12 篇文章 0 订阅

又做了一道,代码写的真心丑,自己都看不下去了..................

code

/*
ID : Your ID
LANG : C++
PROB : transform
*/
#include <set>
#include <map>
#include <ctime>
#include <queue>
#include <cmath>
#include <stack>
#include <limits>
#include <vector>
#include <bitset>
#include <string>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <string.h>
#include <iostream>
#include <algorithm>
#define Si set<int>
#define LL long long
#define pb push_back
#define PS printf(" ")
#define Vi vector<int>
#define LN printf("\n")
#define lson l,m,rt << 1
#define rson m+1,r,rt<<1|1
#define SD(a) scanf("%d",&a)
#define PD(a) printf("%d",a)
#define SET(a,b) memset(a,b,sizeof(a))
#define FF(i,a) for(int i(0);i<(a);i++)
#define FD(i,a) for(int i(a);i>=(1);i--)
#define FOR(i,a,b) for(int i(a);i<=(b);i++)
#define FOD(i,a,b) for(int i(a);i>=(b);i--)
#define readf freopen("input.txt","r",stdin)
#define writef freopen("output.txt","w",stdout)
const int maxn = 1005;
const int INF = 0xfffffff;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};
const double pi = acos(-1.0);
using namespace std;
int N;
char maze[11][11];
char b[11][11];
bool comp(char a[11][11]){
    FOR(i,1,N) FOR(j,1,N){
        if(a[i][j]!=b[i][j]) return false;
    }
    return true;
}
bool rotate_90(){
    char tmp[11][11];
    FOR(i,1,N) FOR(j,1,N){
        tmp[j][N-i+1]=maze[i][j];
    }
    if(comp(tmp)) return true;
    return false;
}
bool rotate_180(){
    char tmp[11][11];
    FOR(i,1,N) FOR(j,1,N){
        tmp[N-i+1][N-j+1]=maze[i][j];
    }
    if(comp(tmp)) return true;
    return false;
}
bool rotate_270(){
    char tmp[11][11];
    FOR(i,1,N) FOR(j,1,N){
        tmp[N-j+1][i]=maze[i][j];
    }
    if(comp(tmp)) return true;
    return false;
}
bool reflect(){
    char tmp[11][11];
    FOR(i,1,N) FOR(j,1,N){
        tmp[i][N-j+1]=maze[i][j];
    }
    if(comp(tmp)) return true;
    return false;
}
bool comb(){
    char tmp1[11][11],tmp2[11][11];
    FOR(i,1,N) FOR(j,1,N){
        tmp1[i][N-j+1]=maze[i][j];
    }
    FOR(i,1,N) FOR(j,1,N){
        tmp2[j][N-i+1]=tmp1[i][j];
    }
    if(comp(tmp2)) return true;
    FOR(i,1,N) FOR(j,1,N){
        tmp2[N-i+1][N-j+1]=tmp1[i][j];
    }
    if(comp(tmp2)) return true;
    FOR(i,1,N) FOR(j,1,N){
        tmp2[N-j+1][i]=tmp1[i][j];
    }
    if(comp(tmp2)) return true;
    return false;
}
int main()
{
    freopen("transform.in","r",stdin);
    freopen("transform.out","w",stdout);
    SD(N);
    FOR(i,1,N) FOR(j,1,N){
        scanf(" %c",&maze[i][j]);
    }
    FOR(i,1,N) FOR(j,1,N) scanf(" %c",&b[i][j]);
    if(rotate_90()){
        puts("1");return 0;
    }
    if(rotate_180()){
        puts("2");return 0;
    }
    if(rotate_270()){
        puts("3");return 0;
    }
    if(reflect()){
        puts("4");return 0;
    }
    if(comb()){
        puts("5");return 0;
    }
    if(comp(maze)){
        puts("6");return 0;
    }
    puts("7");
    return 0;
}





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值