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

31376번 - Bridge Building 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
5.5 초 1024 MB44338.333%

문제

A long time ago in 2009...

In the village Zaykino, heavy rain is common. After such rain, the river Dubrovka which can usually be just stepped over, overflows. To be able to get across the flooded river, the villagers want to build a floating bridge. Luckily, after construction of a bath-house which belongs to a businessman who settled nearby, there are some logs left.

All remaining logs have the same thickness. There are $x$ logs of length $a$ and $y$ logs of length $b$.

The bridge will consist of $l$ rows, each of which will be composed of one or more logs. Unfortunately, the last saw in Zaykino drowned in Dubrovka during the previous overflow and disappeared, so the logs can not be cut into pieces.

The chief engineer wants to build a bridge of maximum possible width. The width of a bridge is determined by the minimum width of a row of logs in it.

For example, if the villagers want to build a bridge of seven rows, and there are six logs of length 3ドル$ and ten logs of length 2ドル,ドル then they can build a bridge of width 5ドル$.

입력

Input contains one or more test cases. Each test case consists of five positive integers $x,ドル $a,ドル $y,ドル $b$ and $l$. Each of these numbers does not exceed 500ドル$. The total number of logs in each test case is at least $l$.

Let $d = \max (x, a, y, b, l)$. It is guaranteed that the sum of $d$ over all the tests is at most 5000ドル$.

출력

For each test case, print an integer on a separate line: the maximum possible width of the bridge.

제한

예제 입력 1

6 3 10 2 7
10 7 20 9 25
106 126 135 28 137

예제 출력 1

5
9
112

힌트

출처

Contest > Open Cup > 2014/2015 Season > Stage 13: Grand Prix of Three Capitals D번

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

출처

대학교 대회

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

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