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

5797번 - Class Packing 다국어

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

문제

Amelia-Bedelia, the principal of the local primary school, is tired of handling the annual confusing problem on the first day of every school year. She wants her computer to solve the problem for her.

The problem is that Amelia-Bedelia finds out, on the first day of school, the number of pupils enrolled in each year from Kindergarten to year 6. She needs to put the pupils in classes in such a way that she uses the smallest number of teachers while adhering to the following Department of Education rules:

  • classes with kindergarten to year 2 pupils must have a size of 20 or less,
  • classes with year 3 and year 4 pupils must have a size of 25 or less,
  • classes with year 5 and year 6 pupils must have a size of 30 or less,
  • a class can only have pupils from one grade or two consecutive grades; for example, a class with Kindergarten and year 1 pupils must have a size of 20 or less, while a class with year 4 and year 5 pupils must have a size of 25 or less.
  • one teacher must be assigned to one, and only one, class.

Your task is to write a program that reads the enrolment numbers and computes the minimum number of teachers required.

입력

The input consists of a number of test cases. The description for each test case consists of seven non-negative integers on a line by themselves. The integers represent the number of pupils enrolled from Kindergarten to year 6 in that order. All integers have values less than 200, and a single space separates the integers.

A line with seven zeroes terminates the input and is not be processed.

출력

The output consists of a single line, for each test case, which contains a single integer that represents the minimum number of teachers required.

제한

예제 입력 1

20 20 20 20 20 20 20
19 1 0 0 0 0 0
19 0 1 0 0 0 0
19 3 0 0 0 0 0
3 48 77 165 173 165 4
125 141 107 8 68 58 176
0 0 0 0 0 0 0

예제 출력 1

6
1
2
2
26
30

힌트

출처

ICPC > Regionals > South Pacific > South Pacific Region > 2012 ACM South Pacific Programming Contest I번

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

출처

대학교 대회

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

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