#include #include #include #include #include using namespace std; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int mat[3][3]; int ans1=0,ans2=0,ans3=0,ans4=0,ans5=0,ans6=0,ans7=0,ans8=0,ans9=0,ans10=0,ans11=0; for(int i=0;i<3;++i){ for(int j=0;j<3;++j){ cin>>mat[i][j]; } } int arr1[3][3]={8,3,4,1,5,9,6,7,2}; int arr2[3][3]={6,1,8,7,5,3,2,9,4}; int arr3[3][3]={2,7,6,9,5,1,4,3,8}; int arr4[3][3]={4,9,2,3,5,7,8,1,6}; int arr5[3][3]={4,3,8,9,5,1,2,7,6}; int arr6[3][3]={6,7,2,1,5,9,8,3,4}; int arr7[3][3]={6,1,8,7,5,3,2,9,4}; int arr8[3][3]={4,9,2,3,5,7,8,1,6}; int arr9[3][3]={2,9,4,7,5,3,6,1,8}; int arr10[3][3]={8,1,6,3,5,7,4,9,2}; // int arr11[3][3]={4,3,2,9,5,7,8,1,6}; for(int i=0;i<3;++i){ for(int j=0;j<3;++j){ ans1+=abs(mat[i][j]-arr1[i][j]); ans2+=abs(mat[i][j]-arr2[i][j]); ans3+=abs(mat[i][j]-arr3[i][j]); ans4+=abs(mat[i][j]-arr4[i][j]); ans5+=abs(mat[i][j]-arr5[i][j]); ans6+=abs(mat[i][j]-arr6[i][j]); ans7+=abs(mat[i][j]-arr7[i][j]); ans8+=abs(mat[i][j]-arr8[i][j]); ans9+=abs(mat[i][j]-arr9[i][j]); ans10+=abs(mat[i][j]-arr10[i][j]); // ans11+=abs(mat[i][j]-arr11[i][j]); } } cout<