No.3354 Comparing Rational Numbers
問題文最終更新日: 2025-09-15 20:21:09
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
yukicoder contest 488 小数誤差コンテスト
(順位表)
の他の問題:
Problem Statement
You are given $2$ rational numbers $P, Q$.
Determine which of $P, Q$ is larger, or whether they are equal.
Input
The input is given from standard input in $2$ lines in the following format:
- The $1$st line contains an integer $N_1$ and a positive integer $D_1$ satisfying $P = \frac{N_1}{D_1}$, separated by a single-byte space.
- The $2$nd line contains an integer $N_2$ and a positive integer $D_2$ satisfying $Q = \frac{N_2}{D_2}$, separated by a single-byte space.
$N_1$ $D_1$ $N_2$ $D_2$
Constraints
The input satisfies the following constraints:
- $N_1$ is an integer satisfying $-10^9 \leq N_1 \leq 10^9$.
- $D_1$ is an integer satisfying $1 \leq D_1 \leq 10^9$.
- $N_2$ is an integer satisfying $-10^9 \leq N_2 \leq 10^9$.
- $D_2$ is an integer satisfying $1 \leq D_2 \leq 10^9$.
Output
Print < if $P < Q$, print > if $P > Q$, and print = if $P = Q$.
Print a newline at the end.
Sample
Sample 1
Input
0 1 0 2
Output
=
We have $P = \frac{0}{1} = \frac{0}{2} = Q$.
Sample 2
Input
-1 2 1 1
Output
<
We have $P = \frac{-1}{2} < \frac{1}{1} = Q$.
Sample 3
Input
-2 3 -3 2
Output
>
We have $P = \frac{-2}{3} > \frac{-3}{2} = Q$.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。