Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- using namespace std;
- int main() {
- int cup = 140,
- bigSpoon = 20,
- smallSpoon = 10,
- cookiesPerBox = 5,
- singleCookieGrams = 25;
- int batches, flour, sugar, cocoa, totalBoxes = 0;
- cin >> batches;
- for (int b = 0; b < batches; b++) {
- cin >> flour >> sugar >> cocoa;
- int flourCups = flour / cup,
- sugarSpoons = sugar / bigSpoon,
- cocoaSpoons = cocoa / smallSpoon;
- int boxesOfCookies = (cup + bigSpoon + smallSpoon)
- * min({ flourCups, sugarSpoons, cocoaSpoons })
- / singleCookieGrams / cookiesPerBox;
- if (boxesOfCookies == 0) {
- cout << "Ingredients are not enough for a box of cookies." << endl;
- }
- else {
- cout << "Boxes of cookies: " << boxesOfCookies << endl;
- totalBoxes += boxesOfCookies;
- }
- }
- cout << "Total boxes: " << totalBoxes << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement