Он ужасен и мне стыдно его показывать, но раз просите..
Код:
#include <iostream>
using namespace std;
int main() {
int count = 0;
for (int i1=0;i1<32;i1++) {
int x1,y1;
if (i1 % 8 < 4)
x1 = (i1%4)*2;
else
x1 = (i1%4)*2 + 1;
y1 = i1/4;
for (int i2=i1+1;i2<32;i2++) {
int x2,y2;
if (i2 % 8 < 4)
x2 = (i2%4)*2;
else
x2 = (i2%4)*2 + 1;
y2 = i2/4;
for (int i3=i2+1;i3<32;i3++) {
int x3,y3;
if (i3 % 8 < 4)
x3 = (i3%4)*2;
else
x3 = (i3%4)*2 + 1;
y3 = i3/4;
for (int i4=i3+1;i4<32;i4++) {
int x4,y4;
if (i4 % 8 < 4)
x4 = (i4%4)*2;
else
x4 = (i4%4)*2 + 1;
y4 = i4/4;
for (int i5=i4+1;i5<32;i5++) {
int x5,y5;
if (i5 % 8 < 4)
x5 = (i5%4)*2;
else
x5 = (i5%4)*2 + 1;
y5 = i5/4;
for (int i6=i5+1;i6<32;i6++) {
int x6,y6;
if (i6 % 8 < 4)
x6 = (i6%4)*2;
else
x6 = (i6%4)*2 + 1;
y6 = i6/4;
for (int i7=i6+1;i7<32;i7++) {
int x7,y7;
if (i7 % 8 < 4)
x7 = (i7%4)*2;
else
x7 = (i7%4)*2 + 1;
y7 = i7/4;
count++;
int arr[8][8];
for (int i=0;i<8;i++)
for (int j=0;j<8;j++)
arr[i][j] = 0;
for (int i=0;i<8;i++)
for (int j=0;j<8;j++)
if ((i-x1 == 2 || x1-i == 2) && (j-y1 == 1 || y1-j==1) || (i-x1 == 1 || x1-i == 1) && (j-y1 == 2 || y1-j==2))
arr[i][j]=1;
for (int i=0;i<8;i++)
for (int j=0;j<8;j++)
if ((i-x2 == 2 || x2-i == 2) && (j-y2 == 1 || y2-j==1) || (i-x2 == 1 || x2-i == 1) && (j-y2 == 2 || y2-j==2))
arr[i][j]=1;
for (int i=0;i<8;i++)
for (int j=0;j<8;j++)
if ((i-x3 == 2 || x3-i == 2) && (j-y3 == 1 || y3-j==1) || (i-x3 == 1 || x3-i == 1) && (j-y3 == 2 || y3-j==2))
arr[i][j]=1;
for (int i=0;i<8;i++)
for (int j=0;j<8;j++)
if ((i-x4 == 2 || x4-i == 2) && (j-y4 == 1 || y4-j==1) || (i-x4 == 1 || x4-i == 1) && (j-y4 == 2 || y4-j==2))
arr[i][j]=1;
for (int i=0;i<8;i++)
for (int j=0;j<8;j++)
if ((i-x5 == 2 || x5-i == 2) && (j-y5 == 1 || y5-j==1) || (i-x5 == 1 || x5-i == 1) && (j-y5 == 2 || y5-j==2))
arr[i][j]=1;
for (int i=0;i<8;i++)
for (int j=0;j<8;j++)
if ((i-x6 == 2 || x6-i == 2) && (j-y6 == 1 || y6-j==1) || (i-x6 == 1 || x6-i == 1) && (j-y6 == 2 || y6-j==2))
arr[i][j]=1;
for (int i=0;i<8;i++)
for (int j=0;j<8;j++)
if ((i-x7 == 2 || x7-i == 2) && (j-y7 == 1 || y7-j==1) || (i-x7 == 1 || x7-i == 1) && (j-y7 == 2 || y7-j==2))
arr[i][j]=1;
bool f = true;
for (int i=0;i<8;i++)
for (int j=0;j<8;j++)
if ((i+j) % 2 == 1)
if (arr[i][j] != 1)
f = false;
if (f){
cout<<"============="<<endl;
cout<<x1<<" "<<y1<<endl;
cout<<x2<<" "<<y2<<endl;
cout<<x3<<" "<<y3<<endl;
cout<<x4<<" "<<y4<<endl;
cout<<x5<<" "<<y5<<endl;
cout<<x6<<" "<<y6<<endl;
cout<<x7<<" "<<y7<<endl;
}
}
}
}
}
}
}
}
cout<<count<<endl;
return 0;
}