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

Talent Show

Platinum III 플래티넘 III
난이도
2s
시간 제한
256MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

Farmer John is bringing his \(N\) cows, conveniently numbered \(1 \ldots N\), to the
county fair, to compete in the annual bovine talent show! His \(i\)th cow has a
weight \(w_i\) and talent level \(t_i\), both integers.

Upon arrival, Farmer John is quite surprised by the new rules for this year's
talent show:

(i) A group of cows of total weight at least \(W\) must be entered into the show
(in order to ensure strong teams of cows are competing, not just strong
individuals), and

(ii) The group with the largest ratio of total talent to total weight shall win.

FJ observes that all of his cows together have weight at least \(W\), so he should
be able to enter a team satisfying (i). Help him determine the optimal ratio of
talent to weight he can achieve for any such team.

Problem credits: Brian Dean

제약

Problem credits: Brian Dean

입력 형식

The first line of input contains \(N\) (\(1 \leq N \leq 250\)) and \(W\)
(\(1 \leq W \leq 1000\)). The next \(N\) lines each describe a cow using two
integers \(w_i\) (\(1 \leq w_i \leq 10^6\)) and \(t_i\) (\(1 \leq t_i \leq 10^3\)).

출력 형식

Please determine the largest possible ratio of total talent over total weight
Farmer John can achieve using a group of cows of total weight at least \(W\). If
your answer is \(A\), please print out the floor of \(1000A\) in order to keep the
output integer-valued (the floor operation discards any fractional part by
rounding down to an integer, if the number in question is not already an
integer).

파일 입력 / 출력
이 문제는 표준 입출력을 사용하지 않습니다. 프로그램은 다음 파일을 읽고 써야 합니다:
입력을 읽을 파일 talent.in
출력을 쓸 파일 talent.out
예제 1
입력
3 15
20 21
10 11
30 31
출력
1066
설명

In this example, the best talent-to-weight ratio overall would be to use just
the single cow with talent 11 and weight 10, but since we need at least 15
units of weight, the optimal solution ends up being to use this cow plus the cow
with talent 21 and weight 20. This gives a talent-to-weight ratio of
(11+21)/(10+20) = 32/30 = 1.0666666..., which when multiplied by 1000 and
floored gives 1066.

문제 정보

riseoj 작성

출처 올림피아드 > USACO > 2017-2018 > US Open > Gold

태그

평가 및 의견

Talent Show

개요
출제자 난이도 Platinum III 플래티넘 III 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

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

풀이 제출

Talent Show

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