QOJ.ac

QOJ

حد الوقت: 1.0 s حد الذاكرة: 32 MB مجموع النقاط: 30

#16988. 表格

الإحصائيات

Perica 一直很擅长数学。他唯一的弱点是加法和除法。为了帮助他克服这一弱点,他的老师给他出了下面这道题。

老师给了他一个 $2 \times 2$ 的表格,其中包含正整数 $A$、$B$、$C$ 和 $D$。

我们定义一个表格的值为:

$$\frac{A}{C} + \frac{B}{D}$$

Perica 的任务是求出使给定表格的值最大化所需的最少顺时针旋转 90 度的次数。

单次顺时针旋转的结果如下图所示。

输入格式

输入的第一行包含两个空格分隔的整数 $A$ 和 $B$。

输入的第二行包含两个空格分隔的整数 $C$ 和 $D$。

所有整数均为正整数且不超过 $100$。

输出格式

输出仅包含一个整数,表示使表格值最大化所需的最少顺时针旋转次数。

样例

输入 1

1 2
3 4

输出 1

2

输入 2

5 9
7 2

输出 2

0

输入 3

41 99
100 13

输出 3

1

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.