A1141 | [COCI-2007_2008-regional]#2 KUHAR
来源COCI
时间限制1s
内存限制128MB
通过 / 提交0/0
题目描述
Lisa works as a waitress in a restaurant. Tonight is her birthday so Lisa asked the chef to prepare his special meal for her friends. The chef's meal is made of N ingredients. To prepare one serving of the meal he needs a certain amount of each ingredient.
There are some ingredients already available in the kitchen and Lisa will buy the rest at the grocery store. The store has all the necessary ingredients, each coming in smaller and larger packages. Lisa has M dollars and wants to spend them so that the chef can make the most servings of his meal.
There are some ingredients already available in the kitchen and Lisa will buy the rest at the grocery store. The store has all the necessary ingredients, each coming in smaller and larger packages. Lisa has M dollars and wants to spend them so that the chef can make the most servings of his meal.
输入格式
The first line contains two integers N and M, 1 ≤ N ≤ 100, 1 ≤ M ≤ 10000
0.
Each of the following N lines contains 6 positive integers, information about one ingredient. These specify, in order:
• X, 10 ≤ X ≤ 100, the amount of the ingredient needed in one serving;
• Y, 1 ≤ Y ≤ 100, the amount of the ingredient already available in the kitchen;
• SM, 1 ≤ SM < 100, the size of the smaller package at the store;
• PM, 10 ≤ PM < 100, the price of the smaller package;
• SV, SM < SV≤ 100, the size of the larger package; and
• PV, PM < PV≤ 100, the price of the larger package.
0.
Each of the following N lines contains 6 positive integers, information about one ingredient. These specify, in order:
• X, 10 ≤ X ≤ 100, the amount of the ingredient needed in one serving;
• Y, 1 ≤ Y ≤ 100, the amount of the ingredient already available in the kitchen;
• SM, 1 ≤ SM < 100, the size of the smaller package at the store;
• PM, 10 ≤ PM < 100, the price of the smaller package;
• SV, SM < SV≤ 100, the size of the larger package; and
• PV, PM < PV≤ 100, the price of the larger package.
输出格式
Output the largest number of servings the chef can make if Lisa spends her money wisely.
输入输出样例
输入 #1
2 100 10 8 10 10 13 11 12 20 6 10 17 24
输出 #1
5
输入 #2
3 65 10 5 7 10 13 14 10 5 8 11 14 15 10 5 9 12 15 16
输出 #2
2
In the first example, for 99 dollars Lisa will buy three smaller and one larger package of the first
ingredient, as well as one smaller and two larger packages of the second ingredient (3·10 + 1·11 + 1·10
+ 2·24 = 99).
The chef will then have 51 units (8 + 3·10 + 1·13) of the first ingredient and 60 units (20 + 1·6 + 2·17)
of the second ingredient, enough for 5 servings.
ingredient, as well as one smaller and two larger packages of the second ingredient (3·10 + 1·11 + 1·10
+ 2·24 = 99).
The chef will then have 51 units (8 + 3·10 + 1·13) of the first ingredient and 60 units (20 + 1·6 + 2·17)
of the second ingredient, enough for 5 servings.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted