Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
15004 | 周燚 | 矩阵对角求和 | C++ | Accepted | 6 MS | 760 KB | 318 | 2021-07-10 16:17:17 |
#include<bits/stdc++.h> using namespace std; int main(){ int n,sum=0,mus=0; int a[101][101]; cin>>n; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ cin>>a[i][j]; if(i==j) sum+=a[i][j]; if(i+j==n-1) mus+=a[i][j]; } } cout<<sum<<endl; cout<<mus<<endl; return 0; }