ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Разделы > Linear Data Structures: Arrays > задача:


50269 - Matrix Determinant

Задачи раздела

• 50360 - National Elections
• 50469 - Letter Grades
• 50468 - Draw Matrix - 2
• 51099 - Mr. Monk
• 51012 - Palindrome-k
• 51096 - Guess the number - 2
• 50448 - Paint Buckets
• 50925 - Optimizing Elevator Usage
• 50269 - Matrix Determinant
• 50988 - Laplacian Filter
• 50986 - The Oldest Person
• 51173 Question 5
• 50873 - Max Frequency
• 51009 - Sum of the nth row
• 51107 - Factorial
• ECE - Question 1
• CEN - Question 1

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
CEN112 Homeworks 15-Spr-Final.

Matrix Determinant

Create a class called Matrix. The Matrix class will hold 2-by-2 integer matrix and have a function called determinant. The determinant of a 2-by-2 matrix is calculated as follows.


Make sure that the class also has
  • A default constructor and a copy constructor
  • Input and output stream operators. Every matrix is in a line (4 integers separated by spaces): A B C D
  • A Determinant function which returns the determinant of the matrix
  • Question: Then, write a program that reads n matrix information and then the program shows the matrices in descending order according to their determinants (the biggest determinant is at the top).

    Input specification
    You will be given two integers (n and m) the number of matrices, and the number of (m) top matrices to show. Then, in each of the following n lines you will be given 4 integers: A, B, C and D where 1 ≤ m ≤ n ≤ 10,000 and the numbers are between -20,000 and +20,000.

    Output specification
    Show the matrices in descending according to their determinants. If there are several matrices having the same determinant show the matrice which comes first in the input.

    Sample Input
    4 3
    0 1 7 2
    5 2 8 8
    5 8 5 1
    2 3 3 10
    Sample Output
    5 2 8 8
    2 3 3 10
    0 1 7 2

    Explanation: The determinant of 5 2 8 8 is 24 and the determinant of 5 8 5 1 is -35.


    Для отправки решений необходимо выполнить вход.

    www.contester.ru