RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
USACO0012 파일 입출력

Escaping the Farm

Silver II 실버 II
난이도
2s
시간 제한
256MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

The cows have decided on a daring plan to escape from the clutches of Farmer John. They have managed to procure a small inflatable raft, and during the cover of night, a group of cows will board the raft and row across the river bordering the farm. The plan seems perfect, until the cows realize that their small inflatable raft may not be able to hold much weight!

The N cows (1 <= N <= 20) have weights w_1 ... w_N. To figure out if a group of cows is light enough to avoid sinking the raft, the cows add up all of the weights in the group. Unfortunately, cows are notoriously bad at arithmetic, and if the addition of the weights of the cows in a group causes any carries to occur (using standard base 10 addition), then the cows give up and conclude that group must weigh too much to use the raft. Any group whose weights can be added without any carries is assumed to be light enough to fit on the raft.

Please help the cows determine the size of the largest group that they believe can fit on the raft (that is, the largest group whose weights can be added together with no carries).

제약
입력 형식

Line 1: The number of cows, N (1 <= N <= 20).

Lines 2..N+1: Each line contains the weight of one cow, an integer in the range 1...100,000,000.

출력 형식

The number of cows in the largest group whose weights can be added together with no carries.

파일 입력 / 출력
이 문제는 표준 입출력을 사용하지 않습니다. 프로그램은 다음 파일을 읽고 써야 합니다:
입력을 읽을 파일 escape.in
출력을 쓸 파일 escape.out
예제 1
입력
5
522
6
84
7311
19
출력
3
설명

Input details: There are 5 cows, with weights 522, 6, 84, 7311, and 19.

Output details: The three weights 522, 6, and 7311 can be added together with no carries: 522 + 6 + 7311 = 7839.

문제 정보

riseoj 작성

출처 올림피아드 > USACO > 2011-2012 > December > Bronze

태그

평가 및 의견

Escaping the Farm

개요
출제자 난이도 Silver II 실버 II 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Escaping the Farm

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8