#include<iostream>
using namespace std;
char oriL[5];
char bian[5];
char jilu[5];
void shuru(char &c, int j, int s) {
if (s) c = (1 << j) | c;
else c = (~(1 << j))&c;
}
int huoqu(char c, int j) {
return (c >> j) & 1;
}
void gai(char &c, int k) {
c = (1 << k) ^ c;
}
void output(int t, char jieguo[]) {
cout << "PU " << t << endl;
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 6; j++) {
cout << huoqu(jieguo[i], j);
if (j < 5) cout << " ";
}
cout << endl;
}
}
int main() {
int T;
cin >> T;
for (int t = 1; t <= T; t++) {
for(int i=0;i<5;i++)
for (int j = 0; j < 6; j++) {
int s;
cin >> s;
shuru(oriL[i], j, s);
}
for (int k = 0; k < 64; k++) {
memcpy(bian, oriL, sizeof(oriL));
//int switchs = k;
jilu[0] = k;
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 6; j++) {
//jilu[i] = switchs;
if (huoqu(jilu[i], j)) {
if (j > 0) gai(bian[i], j - 1);
if (j < 5) gai(bian[i], j + 1);
gai(bian[i], j);
}
}
if (i < 4) bian[i + 1] ^= jilu[i];
jilu[i+1] = bian[i ];
}
if (bian[4] == 0) {
output(t, jilu);
break;
}
}
}
return 0;
}
xideng gai
最新推荐文章于 2024-06-28 13:27:23 发布