当前位置:网站首页>Matrix operation
Matrix operation
2022-06-22 08:10:00 【Study hard 867】
Given a n×n Matrix of , This problem requires the calculation of the matrix divided by the sub diagonal 、 The sum of all elements except the last column and the last row . The sub diagonal is the line from the upper right corner of the matrix to the lower left corner .
Input format :
Enter the first line to give a positive integer n(1<n≤10); And then n That's ok , Each line gives n It's an integer , Separated by spaces .
Output format :
Give the matrix in one row divided by the sub diagonal 、 The sum of all elements except the last column and the last row .
sample input :
4
2 3 4 1
5 6 1 1
7 1 8 1
1 1 1 1
sample output :
35Code :
#include <stdio.h>
int main(){
int m=0,n=0,i=0,j=0;
scanf("%d",&n);
int a[n][n];
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&a[i][j]);
if(i!=n-1&&j!=n-1&&j!=n-1-i)
{
m=m+a[i][j];
}
}
}
printf("%d",m);
return 0;
} 边栏推荐
- 【宋红康 MySQL数据库 】【高级篇】【07】MySQL的存储引擎
- OSI and tcp/ip
- Mt4/mql4 getting started to be proficient in EA tutorial lesson 6 - common functions of MQL language (VI) - common order function
- (9)顺序队列与栈队列
- Cenos7 firewall command
- 《守望先锋》阵亡镜头、全场最佳和亮眼表现是如何设计
- 【Oracle 数据库】奶妈式教程day15 DDL、DML、索引、视图、序列、死锁这一篇就够了
- 力扣(LeetCode)172. 阶乘后的零(2022.06.21)
- Detailed explanation of subnet mask
- Idea reports an error "insufficient memory"
猜你喜欢

It operation and maintenance knowledge map
![[Oracle database] mammy tutorial Day12 character function](/img/77/3b3aa643b0266e709019399b17bb93.png)
[Oracle database] mammy tutorial Day12 character function

Use of keepalived high availability cluster

EURUSD,H1: invalid lots amount for OrderSend function

Relative positioning, absolute positioning, fixed positioning

Energy and interference of waves

Invalid applet margin right, text overflow?

What is distributed transaction
![[Oracle database] mammy tutorial Day11 numerical function](/img/75/6a4340a7e9c6ee5f75a95bb3b6747f.png)
[Oracle database] mammy tutorial Day11 numerical function
![[Oracle database] mammy tutorial day13 date function](/img/ca/90aaa682ec393b1531060377276ca6.png)
[Oracle database] mammy tutorial day13 date function
随机推荐
Why redis is so fast:
How to create an index
Website sharing of program ape -- continuous update
(9)顺序队列与栈队列
mapTalks:基础操作与WMS/WMTS地图服务加载
【Oracle 數據庫】奶媽式教程 day13 日期函數
Relative positioning, absolute positioning, fixed positioning
Invalid applet margin right, text overflow?
The significance of code coverage testing to programming white and its application
swagger中的枚举、自定义类型和swaggerignore
【Oracle 数据库】奶妈式教程day15 DDL、DML、索引、视图、序列、死锁这一篇就够了
KVO summary
Mt4/mql4 getting started to be proficient in EA tutorial lesson 7 - common functions of MQL language (VII) - index value taking function
Mt4/mql4 getting started to mastering EA tutorial lesson 8 - common functions of MQL language (VIII) - common time function
How to design the dead shot, the best and eye-catching performance of the watch Vanguard
QT error prompt 1:invalid use of incomplete type '***‘
QT control adds double click event
JSON使用示例
Example of QT combox
(7)双向链表