Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
93275 | 刘轻松 | 对角线之和 | C++ | Accepted | 1 MS | 280 KB | 276 | 2024-10-13 09:37:00 |
#include<bits/stdc++.h> using namespace std; int a[101][101]; 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; }