Shopping Bags
시간 제한4초메모리 제한1024 MB
크기 S1인 물건 N1개와 크기 S2인 물건 N2개를 용량 T인 가방에 담을 때 필요한 최소 가방 수를 구한다. 단, S2 >= T/4이다.
문제
As usual, you forgot your reusable shopping bags at home. I guess you have to buy some paper bags. You only have two items on your shopping list, but you need to stock up on a certain quantity of each item since you are planing to throw a party. Each item has a size and the paper bags have a maximum total size they can hold. You will want to buy the fewest possible bags.
More precisely, you need to buy copies of the first item and copies of the second item. Each copy of the first item has size and each copy of the second has size . The bags you can buy all have capacity , meaning they can hold any collection of items whose total size is at most .
Determine the fewest bags you must buy such that it is possible to distribute copies of the first item and copies of the second item between these bags while ensuring each bag receives a total item size of at most .
입력
The first line of input contains a single integer (). The second line contains integers and () indicating the number of copies of the two items you must buy. The third line contains integers and () giving the size of a single copy of the respective item. Additionally, the second item will be pretty big: .
출력
Output a single integer on a line by itself indicating the fewest shopping bags that you need to purchase in order to pack all items into the bags.