解题思路:
注意事项:
参考代码:
#include <iostream> using namespace std; int main() { int n = 0, m = 0, a[10][10] = {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) m += a[i][j]; } } cout << m; return 0; }
0.0分
0 人评分