You are viewing a single comment's thread. Return to all comments →
I did something similar. :)
int main(){ int n,*p,i,j,sum,k; scanf("%d",&n); p = (int *)calloc(n,sizeof(int)); for(i=0;i <= n*n - 1;i++) scanf("%d",&p[i]); j=0;k=n-1;sum=0; for(i=1;i<=n;i++) { sum += p[j]; sum -= p[k]; j += n+1; k += n-1; } printf("%d",abs(sum)); return 0;
}
Seems like cookies are disabled on this browser, please enable them to open this website
Diagonal Difference
You are viewing a single comment's thread. Return to all comments →
I did something similar. :)
}