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

5879번 - Balanced Cow Subsets 다국어

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

문제

Farmer John's owns N cows (2 <= N <= 20), where cow i produces M(i) units of milk each day (1 <= M(i) <= 100,000,000). FJ wants to streamline the process of milking his cows every day, so he installs a brand new milking machine in his barn. Unfortunately, the machine turns out to be far too sensitive: it only works properly if the cows on the left side of the barn have the exact same total milk output as the cows on the right side of the barn!

Let us call a subset of cows "balanced" if it can be partitioned into two groups having equal milk output. Since only a balanced subset of cows can make the milking machine work, FJ wonders how many subsets of his N cows are balanced. Please help him compute this quantity.

입력

  • Line 1: The integer N.
  • Lines 2..1+N: Line i+1 contains M(i).

출력

  • Line 1: The number of balanced subsets of cows.

제한

예제 입력 1

4
1
2
3
4

예제 출력 1

3

힌트

Input Details

There are 4 cows, with milk outputs 1, 2, 3, and 4.

Output Details

There are three balanced subsets: the subset {1,2,3}, which can be partitioned into {1,2} and {3}, the subset {1,3,4}, which can be partitioned into {1,3} and {4}, and the subset {1,2,3,4} which can be partitioned into {1,4} and {2,3}.

출처

Olympiad > USA Computing Olympiad > 2011-2012 Season > USACO US Open 2012 Contest > Gold 3번

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

출처

대학교 대회

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

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