奋斗吧少年

184. Patties

time limit per test: 0.25 sec.memory limit per test: 4096 KB

input: standard inputoutput: standard output

Petya is well-known with his famous cabbage patties. Petya’s birthday will come very soon, and he wants to invite as many guests as possible. But the boy wants everybody to try his specialty of the house. That’s why he needs to know the number of the patties he can cook using the stocked ingredients. Petya has P grams of flour, M milliliters of milk and C grams of cabbage. He has plenty of other ingredients. Petya knows that he needs K grams of flour, R milliliters of milk and V grams of cabbage to cook one patty. Please, help Petya calculate the maximum number of patties he can cook.

Input

The input file contains integer numbers P, M, C, K, R and V, separated by spaces and/or line breaks (1 <= P, M, C, K, R, V <= 10000).

Output

Output the maximum number of patties Petya can cook.

Sample test(s)

Input

3000 1000 50030 15 60

Output

8

[submit]

[forum]

Author:Andrew V. Lazarev

Resource:ACM International Collegiate Programming Contest 2003-2004North-Eastern European Region, Southern Subregion

Date:2003 October, 9

思路:直接取三个之中的最小值即可

AC代码:

#include <cstdio>#include <cstring>#include <algorithm>using namespace std;int main() {int P, M, C, K, R, V;while(scanf("%d %d %d", &P, &M, &C) != EOF) {scanf("%d %d %d", &K, &R, &V);int o = P / K, p = M / R, q = C / V;printf("%d\n", min(min(o, p), q));}return 0;}

,将来靠自己双掌;愿你用双掌开拓出美好的梦想。

奋斗吧少年

相关文章:

你感兴趣的文章:

标签云: