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

6786번 - Blood Distribution 다국어

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

문제

At the Canadian Cardiac Centre there are four types of blood available: O, A, B, and AB. Each of these types of blood has an Rh factor, which is either “positive” or “negative”. There are many patients who each require 1 unit of blood. Each patient’s blood type determines the type of blood s/he may receive:

  • Each Type O patient requires Type O blood.
  • Each Type A patient may receive blood of Type A or Type O.
  • Each Type B patient may receive blood of Type B or Type O.
  • The Type AB patients may receive blood of any type.

Patients who have Rh-negative blood can accept Rh-negative blood only, but patients with Rhpositive blood can accept either Rh-positive or Rh-negative types of blood.

We want as many patients as possible to receive a unit of blood. What is the maximum number of patients that can receive blood?

입력

The first line of input contains 8 integers: the number of units of blood of Type O negative, O positive, A negative, A positive, B negative, B positive, AB negative and AB positive. This is followed by a line containing eight numbers: the number of patients whose blood type is O negative, O positive, A negative, A positive, B negative, B positive, and AB negative and AB positive. Each of these integers will be at least 0 and less than 107 .

출력

The output of your program should be a single number: the maximum number of patients that can receive blood.

제한

예제 입력 1

5 5 3 1 2 11 5 12
2 4 9 2 3 9 7 3

예제 출력 1

33

힌트

  • 2 Type O- patients receive Type O- blood
  • 4 Type O+ patients receive Type O+ blood
  • 3 Type A- patients receive Type A- blood
  • 3 Type A- patients receive Type 0- blood
  • 1 Type A+ patients receive Type A+ blood
  • 1 Type A+ patients receive Type O+ blood
  • 2 Type B- patients receive Type B- blood
  • 9 Type B+ patients receive Type B+ blood
  • 5 Type AB- patient receives Type AB- blood
  • 3 Type AB+ patients receive Type AB+ blood

출처

Olympiad > Canadian Computing Competition & Olympiad > 2011 > CCC 2011 Senior Division 4번

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

출처

대학교 대회

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

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