14tps求助
查看原帖
14tps求助
1145476
Axolotl_awa楼主2024/7/25 17:19
#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;

int a[10][10], b[10][10];
int A[10][10], B[10][10], C[10][10], AA[10][10], CA[10][10], CB[10][10], CAA[10][10];
bool bo[7] = {true, true, true, true, true, true, true};

void input (int count) {
    for (int i = 0; i < count; i++) {
        for (int j = 0; j < count; j++) {
            cin >> a[i][j];
        }
    }
    for (int i = 0; i < count; i++) {
        for (int j = 0; j < count; j++) {
            cin >> b[i][j];
        }
    }
}

// 1.图案按顺时针转 90°
void _A (int n) {
    for (int i = 0; i < n; i++) {
        for (int j = 0;j < n; j++) {
            A[j][i] = a[n - 1 - i][j];
        }
    }
}

// 2.图案按顺时针转 180°
void _AA_(int n) {
    int temp[n][n];
    for (int i = 0; i < n; i++) {
        for (int j = 0;j < n; j++) {
            temp[j][i] = a[n - 1 - i][j];
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0;j < n; j++) {
            AA[j][i] = temp[n - 1 - i][j];
        }
    }
}

// 3.图案按顺时针转 270°
void _B (int n) {
    for (int i = 0; i < n; i ++) {
        for (int j = 0;j < n; j ++) {
            B[n - 1 - j][i] = a[i][j];
        }
    }
}

// 4.反射:图案在水平方向翻转(以中央铅垂线为中心形成原图案的镜像)
void _C (int n) {
    for (int i = 0; i < n; i ++) {
        for (int j = 0;j < n; j ++) {
            C[i][j] = a[i][n - j - 1];
        }
    }
    for (int i = 0; i < n; i ++)
        for (int j = 0; j < n; j ++)
            CA[i][j] = C[i][j], CB[i][j] = C[i][j], CAA[i][j] = C[i][j];
}

// 5.组合:图案在水平方向翻转,然后再按照1再次转换。
void _CA(int n) {
    for (int i = 0; i < n; i++) {
        for (int j = 0;j < n; j++) {
            CA[j][i] = a[n - 1 - i][j];
        }
    }
}

// 6.组合:图案在水平方向翻转,然后再按照2再次转换。
void _CB(int n) {
    for (int i = 0; i < n; i ++) {
        for (int j = 0;j < n; j ++) {
            CB[n - 1 - j][i] = a[i][j];
        }
    }
}

// 7.组合:图案在水平方向翻转,然后再按照3再次转换。
void _CAA(int n) {
    int temp[n][n];
    for (int i = 0; i < n; i++) {
        for (int j = 0;j < n; j++) {
            temp[j][i] = a[n - 1 - i][j];
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0;j < n; j++) {
            CAA[j][i] = temp[n - 1 - i][j];
        }
    }
}

void TODO(int n) {
    _A(n);
    _AA_(n);
    _B(n);
    _C(n);
    _CA(n);
    _CB(n);
    _CAA(n);
    for (int i = 0; i < 3; i ++) {
        for (int j = 0; j < 3; j ++) {
            if (b[i][j] != A[i][j])
                bo[0] = false;
            if (b[i][j] != B[i][j])
                bo[1] = false;
            if (b[i][j] != C[i][j])
                bo[2] = false;
            if (b[i][j] != AA[i][j])
                bo[3] = false;
            if (b[i][j] != CA[i][j] || b[i][j] != CB[i][j] || b[i][j] != CAA[i][j])
                bo[4] = false;
            if (b[i][j] != a[i][j])
                bo[5] = false;
        }
    }
}
int main() {
    int n;
    cin >> n;
   
    input(n);

    TODO(n);

    if(bo[0] == true) 
        cout << "1";
    else if(bo[1] == true)
        cout << "2";
    else if(bo[2] == true)
        cout << "3";
    else if(bo[3] == true)
        cout << "4";
    else if(bo[4] == true)
        cout << "5";
    else if(bo[5] == true)
        cout << "6";
    else if(bo[6] == true)
        cout << "7";
    return 0;
}
2024/7/25 17:19
加载中...