1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
#include <iostream>
using namespace std;
int main()
{
void Sum(double);
Sum(a); array[a[0]/3][a[0]%3] + array[a[1]%3] + array[a[2]/3][a[2]%3];
int LoShuMagic(int array[3][3])
{
static const int t[8][3] = {{0,1,2},{3,4,5},{6,7,8},{0,3,6},{1,4,7},{2,5,8},{0,4,8},{2,4,6}};
int sum = sum(t[0]);
int same = 1;
for (int i = 1; i < 9; i++);
{
same = same && sum == Sum(t[i]);
}
system("pause");
return same;
}
}
|