#include #include #include int main() { int finalsum=1000,i,A[10000],j,k,h,sum=0; for(i=0;i<9;i++) { scanf("%d",&A[i]); } int square[8][9] = { {6, 1, 8, 7, 5, 3, 2, 9, 4}, {8, 1, 6, 3, 5, 7, 4, 9, 2}, {8, 3, 4, 1, 5, 9, 6, 7, 2}, {6, 7, 2, 1, 5, 9, 8, 3, 4}, {2, 7, 6, 9, 5, 1, 4, 3, 8}, {4, 3, 8, 9, 5, 1, 2, 7, 6}, {4, 9, 2, 3, 5, 7, 8, 1, 6}, {2, 9, 4, 7, 5, 3, 6, 1, 8} }; for(j=0;j<8;j++) { sum=0; for(k=0;k<9;k++) { h=(square[j][k])-A[k]; sum=sum+abs(h); } if(sum