問題一覧 > 通常問題

No.328 Beautiful Simultaneous Equations

レベル : / AI推定難易度 : 1350 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 67
作問者 : mayoko_ / テスター : 紙ぺーぱー
お気に入りにしたユーザー ProblemId : 703 / 自分の提出
問題文最終更新日: 2026-06-25 03:50:30
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
Advent Calendar Contest 2015 (順位表) の他の問題:

Problem Statement

Consider the following system of equations, where $c_i (i = 1, 2, 3, 4)$ are known and $p_i, z_i (i = 1, 2)$ are unknown.

$c_1 = p_1 + p_2$

$c_2 = p_1 z_1 + p_2 z_2$

$c_3 = p_1 z_1^2 + p_2 z_2^2$

$c_4 = p_1 z_1^3 + p_2 z_2^3$

There are 4 unknowns and also 4 equations, so under certain conditions this system has a unique solution. Here, once one solution is found, another solution obtained by swapping the pair ($p_1, z_1$) with the pair ($p_2, z_2$) is considered to be the same one (see the samples for specifics).

Given $c_1, c_2, c_3, c_4$ for which $p_i, z_i (i = 1, 2)$ have a unique solution, determine whether or not $z_1, z_2$ are both real numbers.

Input

$c_1$ $c_2$ $c_3$ $c_4$



The first line contains the integers $c_1, c_2, c_3, c_4$, separated by spaces. Each value is at least -5000 and at most 5000.

It is guaranteed that the input values do not satisfy $c_1c_3 - c_2^2 = 0$. It is also guaranteed that solving the above system for the given input never results in $z_1 = z_2$. (These constraints ensure that the system has a unique solution.)

Output



If, as a result of solving the system, at least one of $z_1, z_2$ is an imaginary number, output "I" (without the double quotes).

If both $z_1, z_2$ are real numbers, output "R" (without the double quotes).

Do not forget the newline.

Sample

Sample 1
Input
2 1 1 1
Output
R

In this case, the solution of the system is $p_1 = p_2 = 1$, $z_1 = 0$, $z_2 = 1$ ($p_1 = p_2 = 1$, $z_1 = 1$, $z_2 = 0$ is also valid, but these are considered to be the same, so the solution is unique). Here, $z_1, z_2$ are both real numbers, so output "R".

Sample 2
Input
2 2 0 -4
Output
I

In this case, the solution of the system is $p_1 = p_2 = 1$, $z_1 = 1+i, z_2 = 1-i$ (where $i$ is the imaginary unit). $z_1, z_2$ are imaginary numbers, so output "I".

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。