Tablica
의견: 0
Perica was always very good at math. His only weak points were addition and division. To help him with that, his teacher presented him with the following problem.
She gave him a \(2 \times 2\) table containing positive integers \(A\), \(B\), \(C\) and \(D\), arranged like this:
$$ \begin{pmatrix} A & B \\ C & D \end{pmatrix} $$
The value of the table is defined as
$$ \frac{A + B}{C + D}, $$
the sum of the numbers in the top row divided by the sum of the numbers in the bottom row.
Perica's task is to find the minimum number of \(90^\circ\) clockwise rotations required to maximize the value of a given table. A single clockwise rotation transforms the table \(\begin{pmatrix} A & B \\ C & D \end{pmatrix}\) into \(\begin{pmatrix} C & A \\ D & B \end{pmatrix}\).
The first line of input contains two space separated integers, \(A\) and \(B\).
The second line of input contains two space separated integers, \(C\) and \(D\).
All integers are positive and not greater than \(100\).
The first and only line of output must contain a single integer, minimum number of clockwise rotations
required to maximize the table’s value.
| 서브태스크 | 점수 | 설명 |
|---|---|---|
Test 1 | 20점 | None |
Test 2 | 20점 | None |
Test 3 | 20점 | None |
Test 4 | 20점 | None |
Test 5 | 20점 | None |
1 2
3 425 9
7 2041 99
100 131평가 및 의견
Tablica
Log in to rate problems.
아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.
풀이 제출
Tablica