#include #include #include using namespace std; int main() { int s[9]; int m1[9]={2,7,6,9,5,1,4,3,8}; int m2[9]={4,9,2,3,5,7,8,1,6}; int m3[9]={6,1,8,7,5,3,2,9,4}; int m4[9]={8,3,4,1,5,9,6,7,2}; int m5[9]={8,1,6,3,5,7,4,9,2}; int m6[9]={2,9,4,7,5,3,6,1,8}; int m7[9]={4,3,8,9,5,1,2,7,6}; int m8[9]={6,7,2,1,5,9,8,3,4}; int sum1=0; int sum2=0; int sum3=0; int sum4=0; int sum5=0; int sum6=0; int sum7=0; int sum8=0; int temp; for(int i=0;i<9;i++) { cin>>s[i]; } for(int i=0;i<9;i++) { sum1+=abs(s[i]-m1[i]); sum2+=abs(s[i]-m2[i]); sum3+=abs(s[i]-m3[i]); sum4+=abs(s[i]-m4[i]); sum5+=abs(s[i]-m5[i]); sum6+=abs(s[i]-m6[i]); sum7+=abs(s[i]-m7[i]); sum8+=abs(s[i]-m8[i]); } if(sum1<=sum2 && sum1<=sum3 && sum1<=sum4 && sum1<=sum5 &&sum1<=sum6 && sum1<=sum7 && sum1<=sum8) cout<=sum5 &&sum5<=sum6 && sum5<=sum7 && sum5<=sum8) cout<=sum6 && sum6<=sum7 && sum6<=sum8) cout<=sum7 && sum7<=sum8) cout<=sum8) cout<