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

26992번 - The Water Bowls 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB251927544.379%

문제

The cows have a line of 20 water bowls from which they drink. The bowls can be either right-side-up (properly oriented to serve refreshing cool water) or upside-down (a position which holds no water). They want all 20 water bowls to be right-side-up and thus use their wide snouts to flip bowls.

Their snouts, though, are so wide that they flip not only one bowl but also the bowls on either side of that bowl (a total of three or -- in the case of either end bowl -- two bowls).

Given the initial state of the bowls (1=undrinkable, 0=drinkable -- it even looks like a bowl), what is the minimum number of bowl flips necessary to turn all the bowls right-side-up?

입력

  • Line 1: A single line with 20 space-separated integers

출력

  • Line 1: The minimum number of bowl flips necessary to flip all the bowls right-side-up (i.e., to 0). For the inputs given, it will always be possible to find some combination of flips that will manipulate the bowls to 20 0's.

제한

예제 입력 1

0 0 1 1 1 0 0 1 1 0 1 1 0 0 0 0 0 0 0 0

예제 출력 1

3

힌트

출처

Olympiad > USA Computing Olympiad > 2005-2006 Season > USACO January 2006 Contest > Bronze ?번

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

출처

대학교 대회

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

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