解题思路:
注意事项:
参考代码:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e3;
ll a[N][N];
int main()
{
ll sum=0,summer=0;
for(int i=1; i<=3; i++)
for(int j=1; j<=3; j++)
cin>>a[i][j];
for(int i=1; i<=3; i++)
for(int j=1; j<=3; j++)
{
if(i==j)
sum+=a[i][j];
if(i+j==4)
summer+=a[i][j];
}
cout<<sum<<' '<<summer;
return 0;
}
0.0分
0 人评分