HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Linear Data Structures: Arrays > problem:


51095 - Normal and Trace

Section problems

• 51042 - The most frequent k-mer
• 50271 - Factorial
• 50382 - Parkside's Other Triangle
• 51171 Question 3
• 51093 - rgb2gray
• 51165 Question 1
• 51175 Question 2
• 51092 - Even and Odd
• 51095 - Normal and Trace
• 50423 - Numbers square
• 50300 - Matrix
• 50319 - Toll Plazas
• 50977 - Gaussian Elimination
• 50380 - Sum of the Numbers in the ...
• 50318 - Product Info
• 50326 - Matrix Operations
• 50395 - Page "Like" Averages

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
bfs.

Normal and Trace

Question: Given a 2D square matrix, the task is to find Normal and Trace  of matrix.

Normal of a matrix is defined as square root of sum of squares of matrix elements.

Trace of a n x n square matrix is sum of diagonal elements

 

Input specification: In the first line you will be given one integer number (1<=n<=500)  the dimension of matrix, then in following n lines you will be given a square matrix size of n by n, where each element of matrix is in reange 1 to 100

 

Output specification: Show Normal with two digits after the floating point and Trace of matrix .

Sample Input I 

3
6 3 2
5 2 4
1 2 4

Sample Output I

10.72 12

 Sample Input I Explanation

 
Normal= sqrt(6*6+3*3+2*2+5*5+2*2+4*4+1*1+2*2+4*4)=10.72
Trace=6+2+4=12
Для отправки решений необходимо выполнить вход.

www.contester.ru