-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path151A_Soft_Drinking.cpp
More file actions
59 lines (47 loc) · 2.02 KB
/
151A_Soft_Drinking.cpp
File metadata and controls
59 lines (47 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* A. Soft Drinking
time limit per test 2 seconds
memory limit per test 256 megabytes
This winter is so cold in Nvodsk! A group of n friends decided to buy k bottles of a soft drink called "Take-It-Light" to warm up a bit.
Each bottle has l milliliters of the drink.
Also they bought c limes and cut each of them into d slices. After that they found p grams of salt.
To make a toast, each friend needs nl milliliters of the drink, a slice of lime and np grams of salt.
The friends want to make as many toasts as they can, provided they all drink the same amount. How many toasts can each friend make?
Input
The first and only line contains positive integers n, k, l, c, d, p, nl, np, not exceeding 1000 and no less than 1.
The numbers are separated by exactly one space.
Output
Print a single integer — the number of toasts each friend can make.
Examples
Input:
3 4 5 10 8 100 3 1
Output:
2
Input:
5 100 10 1 19 90 4 3
Output:
3
Input:
10 1000 1000 25 23 1 50 1
Output:
0
Note
A comment to the first sample:
Overall the friends have 4 * 5 = 20 milliliters of the drink, it is enough to make 20 / 3 = 6 toasts.
The limes are enough for 10 * 8 = 80 toasts and the salt is enough for 100 / 1 = 100 toasts.
However, there are 3 friends in the group, so the answer is min(6, 80, 100) / 3 = 2.
*/
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int n, k, l, c, d, p, nl, np;
cin >> n >> k >> l >> c >> d >> p >> nl >> np;
int total_drink = k * l;
int total_slices = c * d;
int toasts_by_drink = total_drink / nl;
int toasts_by_limes = total_slices;
int toasts_by_salt = p / np;
int total_toasts = min({toasts_by_drink, toasts_by_limes, toasts_by_salt});
cout << total_toasts / n << endl;
return 0;
}