蓝桥杯 九宫重排
C++
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <queue>
using namespace std;
int dx[] = {
1, -1, 0, 0};
int dy[] = {
0, 0, 1, -1};
int factor[] = {
1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800};
bool vis[400000];
struct Node {
int x, y, st, pos, step;
string s;
Node() {
}
Node(int _x, int _y, int _pos) {
x = _x;
y = _y;
pos = _pos;
}
};
int cantor(string s) {
int ans = 0;
for(int i = 0; i < 8; i ++) {
int num = 0;
for(int j = i + 1; j <= 8; j ++) {
if(s[j] < s[i]) num ++;
}
ans = ans + num *