問題一覧 > 通常問題

No.2400 Product of Gaussian Integer

レベル : / AI推定難易度 : 126 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 241
作問者 : 👑 獅子座じゃない人 / テスター : 👑 amentorimaru
お気に入りにしたユーザー ProblemId : 9815 / 自分の提出
問題文最終更新日: 2023-08-03 22:02:10
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 400 (順位表) の他の問題:

Problem Statement

Let $i$ be the imaginary unit. That is, consider $i$ to be a number satisfying $i^2=-1$.

Given integers $A,B,C,D$, print the integers $N,M$ satisfying $(A+Bi)(C+Di)=N+Mi$.

It can be proved that, under the constraints of this problem, there exist integers $N,M$ satisfying $(A+Bi)(C+Di)=N+Mi$.

Input

$A\ B$
$C\ D$

  • All inputs are integers
  • $-10^9\leq A\leq 10^9$
  • $-10^9\leq B\leq 10^9$
  • $-10^9\leq C\leq 10^9$
  • $-10^9\leq D\leq 10^9$

Output

$N\ M$

Print $1$ line, followed by a newline at the end.

Sample

Sample 1
Input
1 1
2 -1
Output
3 1

Since $(1+i)(2-i)=1\cdot 2+2\cdot i+1\cdot (-i)+i\cdot (-i)=2+2i-i-i^2=2+(2-1)i-(-1)=3+i$, print 3 and 1.

Sample 2
Input
0 0
0 0
Output
0 0

Sample 3
Input
123456789 1
123456789 -1
Output
15241578750190522 0

The answer may not fit in a 32-bit integer type.

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