A - Three cards Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MB

配点 : 9

問題文

3 枚のカードがあります。 1 枚目のカードには整数 A が、2 枚目のカードには整数 B が、3 枚目のカードには整数 C が書かれています。

3 枚のカードの中から 2 枚のカードを選ぶとき、選んだ 2 枚に書かれた整数の積としてあり得る最小値と最大値を出力して下さい。

制約

  • -100 \leq A, B, C \leq 100
  • A, B, C は整数

入力

入力は以下の形式で標準入力から与えられる。

A B C

出力

選んだ 2 枚に書かれた整数の積としてあり得る最小値 X と最大値 Y を、下記の通りに空白区切りで出力せよ。

X Y

入力例 1

5 -2 4

出力例 1

-10 20

選んだ 2 枚に書かれた整数の積は、

  • 1 枚目と 2 枚目のカードを選んだとき、5 \times (-2) = -10
  • 1 枚目と 3 枚目のカードを選んだとき、5 \times 4 = 20
  • 2 枚目と 3 枚目のカードを選んだとき、(-2) \times 4 = -8

です。よって、選んだ 2 枚に書かれた整数の積としてあり得る最小値は -10 、最大値は 20 です。


入力例 2

0 0 0

出力例 2

0 0

Score : 9 points

Problem Statement

There are 3 cards. The 1-st card has an integer A written on it; the 2-nd has an integer B; the 3-rd has an integer C.

When choosing 2 cards out of these 3 cards, find the minimum and maximum possible products of the integers written on the chosen 2 cards.

Constraints

  • -100 \leq A, B, C \leq 100
  • A, B, and C are integers

Input

Input is given from Standard Input in the following format:

A B C

Output

Find the minimum possible product X and the maximum possible product Y of the integers written on the chosen 2 cards in the following format, with a space in between.

X Y

Sample Input 1

5 -2 4

Sample Output 1

-10 20

The product of the integers written on the chosen 2 cards will be

  • 5 \times (-2) = -10 if the 1-st and the 2-nd cards were chosen;
  • 5 \times 4 = 20 if the 1-st and the 3-rd cards were chosen;
  • (-2) \times 4 = -8 if the 2-nd and the 3-rd cards were chosen.

Therefore, the minimum possible product of the 2 integers written on the chosen 2 cards are -10, and the maximum is 20.


Sample Input 2

0 0 0

Sample Output 2

0 0