14分求调
查看原帖
14分求调
1023732
FlowerAccepted楼主2024/7/12 17:53

这有什么问题啊!才十四分(连样例都过不了)

#include <algorithm>
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;

int n;

struct matrix {
    char a[12][12];
    void read() {
        for (int i = 0; i < n; i ++) {
            for (int j = 0; j < n; j ++) {
                scanf(" %c", a[i] + j);
            }
        }
    }
    matrix rotate() {
        matrix r;
        for (int i = 0; i < n; i ++) {
            for (int j = 0; j < n; j ++) {
                r.a[i][j] = a[n - j - 1][i];
            }
        }
        return r;
    }
    matrix reflex() {
        matrix r;
        for (int i = 0; i < n; i ++) {
            for (int j = 0; j < n; j ++) {
                r.a[i][j] = a[i][n - j - 1];
            }
        }
        return r;
    }
    bool operator == (matrix b) {
        for (int i = 0; i < n; i ++) {
            for (int j = 0; j < n; j ++) {
                if (a[i][j] != b.a[i][j]) {
                    return 0;
                }
            }
        }
        return 1;
    }
} a, b, c;

int main() {
    cin >> n;
    a.read();
    b.read();
    c = a;
    for (int i = 1; i <= 3; i ++) {
        c.rotate();
        if (b == c) {
            cout << i;
            return 0;
        }
    }
    c = a.reflex();
    if (b == c) {
        cout << 4;
        return 0;
    }
    for (int i = 1; i <= 3; i ++) {
        c.rotate();
        if (b == c) {
            cout << 5;
            return 0;
        }
    }
    if (a == b) {
        cout << 6;
        return 0;
    }
    cout << 7;
    return 0;
}

恳请大佬帮帮蒟蒻,PLS!!
ygg plsygg\ pls

2024/7/12 17:53
加载中...