欢迎复制!(拿去研究就行了别提交)
#include<iostream>
using namespace std;
const int maxn = 1001;
int a[maxn][maxn];
int main(){
int n, sum = 0;
cin >> n;
for(int i = 1; i <= n; i++){
for(int j = 1; j <= n; j++){
cin >> a[i][j];
if(i == j || i+j == n+1)
sum += a[i][j];
}
}
cout << sum;
return 0;
}