Auto commit
This commit is contained in:
parent
5f169e30ac
commit
2a43e05b5f
@ -457,6 +457,35 @@ int main(){
|
||||
方阵中主对角线、副对角线的索引和方阵的行、列有什么关系?
|
||||
```
|
||||
|
||||
```c
|
||||
#include <stdio.h>
|
||||
|
||||
int main(){
|
||||
int n, s = 0;
|
||||
scanf("%d", &n);
|
||||
int a[n][n];
|
||||
|
||||
for(int i=0;i<n;i++){
|
||||
for(int j=0;j<n;j++){
|
||||
scanf("%d", &a[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0;i<n;i++){
|
||||
for(int j=0;j<n;j++){
|
||||
if(i != n-1 && j != n-1 && i+j != n-1){
|
||||
s += a[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf("%d\n", s);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### 10 矩阵乘积
|
||||
|
Loading…
x
Reference in New Issue
Block a user