Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
6701 | 黄言岐 | 对角线之和 | C++ | Accepted | 0 MS | 264 KB | 587 | 2025-03-12 20:17:30 |
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int b=0; int main(){ int N,a[11][11]; cin>>N; for(int i=0;i<N;i++){ for(int j=0;j<N;j++){ cin>>a[i][j]; if(i==j) b+=a[i][j]; if(i+j==N-1) b+=a[i][j]; } } if(N%2!=0) b-=a[N/2][N/2]; cout<<b<<endl; return 0; }