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

7119번 - The Magician 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB31191657.143%

문제

The circus magician Tâlrîts Vakars shows magic tricks. In his demonstrations he uses only:

baloons (), doves (), rabbits () and poodels ().

Tâlrîts can carry out only the following tricks: (baloons and animals in the direction shown by the arrow are converted to different animals):

  1. + +
  2. + +
  3. + +

Your task is to write a program that for the input number of baloons, doves, rabbits and poodels computes the maximum possible number of rabbits that Tâlrîts can obtain and the least number of tricks required to do this.

입력

The values of non-negative integer numbers b (number of baloons, b ≤ 150), d (number of doves, d ≤ 150), t (number of rabbits, t ≤ 150) and p (number of poodels, p ≤ 150) are input from the keyboard. It is also known that b + d + t + p ≤ 250.

출력

The maximum possible number of rabbits that Tâlrîts can obtain must be displayed on the screen, as well as (separated by a space symbol) the minimal number of tricks that is required to obtain this number of rabbits.

제한

예제 입력 1

9 17 1 3

예제 출력 1

10 3

예제 입력 2

3 0 2 2

예제 출력 2

4 2

힌트

출처

Olympiad > Latvian olympiad in informatics > 11th Latvian olympiad in informatics > Stage III (Country) 4번

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

출처

대학교 대회

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

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