#include #include #include #include int main(int argc, char** argv) { int first[3][3]={ {2,7,6}, {9,5,1}, {4,3,8} }; int eighth[3][3]={ {4,3,8}, {9,5,1}, {2,7,6} }; int second[3][3]={ {4,9,2}, {3,5,7}, {8,1,6} }; int seventh[3][3]={ {8,1,6}, {3,5,7}, {4,9,2} }; int third[3][3]={ {8,3,4}, {1,5,9}, {6,7,2} }; int sixth[3][3]={ {6,7,2}, {1,5,9}, {8,3,4} }; int forth[3][3]={ {6,1,8}, {7,5,3}, {2,9,4} }; int fifth[3][3]={ {2,9,4}, {7,5,3}, {6,1,8} }; int in; int a1=0,a2=0,a3=0,a4=0,a5=0,a6=0,a7=0,a8=0; for(int i=0;i<3;i++) { for(int j=0;j<3;j++) { scanf("%d",&in); a1+=abs(in-first[i][j]); a2+=abs(in-second[i][j]); a3+=abs(in-third[i][j]); a4+=abs(in-forth[i][j]); a5+=abs(in-fifth[i][j]); a6+=abs(in-sixth[i][j]); a7+=abs(in-seventh[i][j]); a8+=abs(in-eighth[i][j]); } } int min=a1; if(a2