Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
93269 黎瑾萱 对角线之和 C++ Accepted 1 MS 268 KB 248 2024-10-13 09:31:51

Tests(10/10):


Code:

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