B - 前後
解説
/
/
実行時間制限: 2 sec / メモリ制限: 1024 MiB
問題文
A+C=B または B+C=A を満たす 3 つの整数が与えられます。
2 つの等式のうち、成立する方を x+C=y とします。
この等式の x,y,C を x -> y (C) の形で出力してください。
ただし、 C については符号付きで出力してください。
具体例を示します。
- A=1000, B=1050, C=50 のとき 1000+50=1050 が成立するので、
1000 -> 1050 (+50)と出力してください。 - A=1000, B=1050, C=-50 のとき 1050+(-50)=1000 が成立するので、
1050 -> 1000 (-50)と出力してください。
制約
- 入力は全て整数
- 0 \le A,B \le 5000
- -5000 \le C \le 5000
- C \neq 0
- A+C=B または B+C=A が成り立つ
入力
入力は以下の形式で標準入力から与えられる。
A B C
出力
答えを出力せよ。
入力例 1
1000 1050 50
出力例 1
1000 -> 1050 (+50)
入力例 2
1000 1050 -50
出力例 2
1050 -> 1000 (-50)
入力例 3
1234 1111 -123
出力例 3
1234 -> 1111 (-123)
入力例 4
3000 2500 500
出力例 4
2500 -> 3000 (+500)
Problem Statement
You are given three integers satisfying A+C=B or B+C=A.
Among these two equations, let x+C=y be the one that is satisfied.
Print x,y,C in this equation in the format x -> y (C).
Here, C must be printed as a signed integer.
For example:
- If A=1000, B=1050, C=50, we have 1000+50=1050, so print
1000 -> 1050 (+50). - If A=1000, B=1050, C=-50, we have 1050+(-50)=1000, so print
1050 -> 1000 (-50).
Constraints
- All input values are integers.
- 0 \le A,B \le 5000
- -5000 \le C \le 5000
- C \neq 0
- A+C=B or B+C=A.
Input
The input is given from Standard Input in the following format:
A B C
Output
Print the answer.
Sample Input 1
1000 1050 50
Sample Output 1
1000 -> 1050 (+50)
Sample Input 2
1000 1050 -50
Sample Output 2
1050 -> 1000 (-50)
Sample Input 3
1234 1111 -123
Sample Output 3
1234 -> 1111 (-123)
Sample Input 4
3000 2500 500
Sample Output 4
2500 -> 3000 (+500)