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

Турниры > CEN110 Practice Exam 2 > задача:


3. 50269 - Matrix Determinant

CEN110 Practice Exam 2

Старт: 01.июня.2017 в 09:08:00
Финиш: 01.июня.2017 в 10:05:00
Турнир завершён!
• Турнирная таблица

Задачи турнира

• 1. 50986 - The Oldest Person
• 2. 50526 - Gold Market
• 3. 50269 - Matrix Determinant
• 4. 50747 - Safe boxes against thieves

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

Если у вас есть предложения или пожелания по работе 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