Logo
(追記) (追記ここまで)

19751번 - Fractification 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB50433930768.071%

문제

Little children love to break their toys so much! And little Andrew is no exception, he breaks into fragments everything he sees. This time he is about to break a set of four positive integers.

Let's say that fractification of four integers ($a,ドル $b,ドル $c,ドル $d$) is the sum $$ \frac{a}{b} + \frac{c}{d} $$. Little Andrew doesn't like anything larger that himself, so he wants fractification to be as small as possible.

You were asked to help Andrew in making the fractification of given four integers minimal possible if you are allowed to swap theese integers with each other any way you want.

입력

In the first and only line of input there are four positive integers $a,ドル $b,ドル $c$ and $d$ splitted by space ($ 1 \le a, b, c, d \le 10^9 $).

출력

Print four integers which are the permutation of given four, so their fractification is minimal possible. If there are more than one such permutations, print any.

제한

예제 입력 1

1 2 3 4

예제 출력 1

1 3 2 4

예제 입력 2

5 5 5 5

예제 출력 2

5 5 5 5

힌트

In the first example output permutation gives us the value of $$ \frac{1}{3} + \frac{2}{4} = \frac{5}{6} $$ which is minimal.

In the second example only possible output leads to value of $$ \frac{5}{5} + \frac{5}{5} = 2 $$

출처

Olympiad > Russian Olympiad in Informatics > Russia High School Programming Contest > Russia High School Programming Contest 2017 K번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /