Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main() {
- int quantity, sugar, flour, maxSugar = 0, maxFlour = 0;
- cin >> quantity;
- double totalSugar = 0, totalFlour = 0;
- for (int i = 0; i < quantity; i++) {
- cin >> sugar >> flour;
- if (maxSugar < sugar) {
- maxSugar = sugar;
- }
- if (maxFlour < flour) {
- maxFlour = flour;
- }
- totalSugar += sugar;
- totalFlour += flour;
- }
- cout << "Sugar: " << ceil(totalSugar / 950) << endl << "Flour: " << ceil(totalFlour / 750) << endl
- << "Max used flour is " << maxFlour << " grams, max used sugar is " << maxSugar << " grams.\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement