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

Don't Be Last!

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

의견: 0

설명

Farmer John owns 7 dairy cows: Bessie, Elsie, Daisy, Gertie, Annabelle, Maggie,
and Henrietta. He milks them every day and keeps detailed records on the amount
of milk provided by each cow during each milking session. Not surprisingly,
Farmer John highly prizes cows that provide large amounts of milk.

Cows, being lazy creatures, don't necessarily want to be responsible for
producing too much milk. If it were up to them, they would each be perfectly
content to be the lowest-producing cow in the entire herd. However, they keep
hearing Farmer John mentioning the phrase "farm to table" with his human
friends, and while they don't quite understand what this means, they have a
suspicion that it actually may not be the best idea to be the cow producing the
least amount of milk. Instead, they figure it's safer to be in the position of
producing the second-smallest amount of milk in the herd. Please help the cows
figure out which of them currently occupies this desirable position.

Problem credits: Brian Dean

제약

Problem credits: Brian Dean

입력 형식

The input file for this task starts with a line containing the integer \(N\)
(\(1 \leq N \leq 100\)), giving the number of entries in Farmer John's milking
log.

Each of the \(N\) following lines contains the name of a cow (one of the seven
above) followed by a positive integer (at most 100), indicating the amount of
milk produced by the cow during one of its milking sessions.

Any cow that does not appear in the log at all is assumed to have produced no
milk.

출력 형식

On a single line of output, please print the name of the cow that produces the
second-smallest amount of milk. More precisely, if \(M\) is the minimum total
amount of milk produced by any cow, please output the name of the cow whose
total production is minimal among all cows that produce more than \(M\) units of
milk. If several cows tie for this designation, or if no cow has this
designation (i.e., if all cows have production equal to \(M\)), please output the
word "Tie". Don't forget to add a newline character at the end of your line of
output. Note that \(M=0\) if one of the seven cows is completely absent from the
milking log, since this cow would have produced no milk.

파일 입력 / 출력
이 문제는 표준 입출력을 사용하지 않습니다. 프로그램은 다음 파일을 읽고 써야 합니다:
입력을 읽을 파일 notlast.in
출력을 쓸 파일 notlast.out
예제 1
입력
10
Bessie 1
Maggie 13
Elsie 3
Elsie 4
Henrietta 4
Gertie 12
Daisy 7
Annabelle 10
Bessie 6
Henrietta 5
출력
Henrietta
설명

In this example, Bessie, Elsie, and Daisy all tie for the minimum by each
producing 7 units of milk. The next-largest production, 9 units, is due to
Henrietta.

문제 정보

riseoj 작성

출처 올림피아드 > USACO > 2016-2017 > January > Bronze

태그

평가 및 의견

Don't Be Last!

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

Log in to rate problems.

개별 의견

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

풀이 제출

Don't Be Last!

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