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

22286번 - Small Schedule 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB50292152.500%

문제

Everybody is into cloud computing these days, so quite a few different business models are being experimented with. You are trying a very simple one: you sell time on your machines in one of two batches called slots. A customer can buy one second of CPU time or $Q$ seconds for some integer $Q$.

Each time slot a customer purchases must be completed on a single machine, but you get to decide how to allocate the purchased time slots between machines.

After coming back from a long vacation, you see that all of your machines are idle and a variety of orders have come in. To keep customers happy, you must decide how to distribute these requests between machines in a way that minimizes the time when the purchased time slots are finally all completed.

What is the smallest amount of time in which you can complete all of the purchased time slots?

입력

The input consists of a single line containing four integers $Q$ (2ドル \leq Q \leq 1,000円$), which is the time needed to complete the longer batches, $M$ (1ドル \leq M \leq 1,000円,000円$), which is the number of machines owned by your company, $S$ (0ドル \leq S \leq 1,000円,000円$), which is the number of 1-second time slots purchased, and $L$ (0ドル \leq L \leq 1,000円,000円$), which is the number of $Q$-second time slots purchased.

출력

Display the smallest amount of time in which you can complete all of the purchased time slots.

제한

예제 입력 1

2 4 3 6

예제 출력 1

4

예제 입력 2

3 4 3 5

예제 출력 2

6

예제 입력 3

10 2 0 1

예제 출력 3

10

힌트

출처

ICPC > Regionals > North America > Rocky Mountain Regional > 2018 Rocky Mountain Regional Contest H번

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

출처

대학교 대회

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

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