Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
152353 李昱龙 对角线之和 C++ Accepted 1 MS 276 KB 316 2026-04-25 15:02:28

Tests(10/10):


Code:

#include<bits/stdc++.h> using namespace std; int a[100][100]; int main(){ int n,sum=0; cin>>n; for(int i=1;i<=n;i++){ for(int j=n;j>=1;j--){ cin>>a[i][j]; } } for(int i=1;i<=n;i++){ for(int j=n;j>=1;j--){ if(i==j||i+j==n+1){ sum+=a[i][j]; } } } cout<<sum; return 0; }