Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
94643 | 卢语涵 | 对角线之和 | C++ | Wrong Answer | 1 MS | 268 KB | 1908 | 2024-10-25 22:02:53 |
#include<bits/stdc++.h> using namespace std; /*int a[101][101],n,m; int main(){ cin>>n; cin>>m; for(int i=0;i<=n-1;i++){ for(int j=0;j<=n-1;j++){ cin>>a[i][j]; if(i==j){ a[i][j]+=m; } if(i+j==n-1){ a[i][j]+=m; } } } for(int i=0;i<=n-1;i++){ for(int j=0;j<=n-1;j++){ printf("%5d",a[i][j]); } cout<<endl; }*/ /*int a[101][101]; int b[101][101]; int n,m; int main(){ cin>>n>>m; for(int i = 0;i <= n - 1;i++){ for(int j = 0;j < m - 1;j++){ cin >> a[i][j]; } } for(int i = 0;i <= n - 1;i++){ for(int j = 0;j <= m - 1;j++){ if(i == 0 || j == 0 || i == n-1 || j == m-1){ b[i][j] = a[i][j]; }else{ double tmp = (a[i][j] + a[i-1][j] + a[i+1][j] + a[i][j-1] + a[i][j+1])/5.0; b[i][j] = tmp; if(tmp - b[i][j] >= 0.5){ b[i][j] += 1; } } cout << b[i][j] << " "; } cout << endl; } */ /*int main(){ int n,i1,j1; cin>>n>>i1>>j1; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ if(i == i1){ cout<<"("<<i<<","<<j<<")"<<" "; } } } cout<<endl; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ if(j == j1){ cout<<"("<<i<<","<<j<<")"<<" "; } } } cout<<endl; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ if(j-i == j1-i1){ cout<<"("<<i<<","<<j<<")"<<" "; } } } cout<<endl; for(int i=n;i>=1;i--){ for(int j=1;j<=n;j++){ if(j+i == j1+i1){ cout<<"("<<i<<","<<j<<")"<<" "; } } } cout<<endl; return 0; }1479 1481*/ int main(){ int n,g=0; cin>>n; int a[n][n]; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ cin>>a[i][j]; if(i==j) g+=a[i][j]; } } for(int i=0;i<n;i++){ for(int j=n-1;j>=0;j--){ if(i+j==n-1) g=g+a[i][j]; } } cout<<g; return 0; }
------Input------
5 289 405 453 530 261 553 893 500 893 724 873 313 343 885 933 268 495 115 355 340 729 833 962 654 886
------Answer-----
5144
------Your output-----
5487