Advertisement
Spocoman

Easter Bake

Sep 17th, 2023 (edited)
723
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     int quantity, sugar, flour, maxSugar = 0, maxFlour = 0;
  8.     cin >> quantity;
  9.  
  10.     double totalSugar = 0, totalFlour = 0;
  11.  
  12.     for (int i = 0; i < quantity; i++) {
  13.         cin >> sugar >> flour;
  14.  
  15.         if (maxSugar < sugar) {
  16.             maxSugar = sugar;
  17.         }
  18.         if (maxFlour < flour) {
  19.             maxFlour = flour;
  20.         }
  21.  
  22.         totalSugar += sugar;
  23.         totalFlour += flour;
  24.     }
  25.  
  26.     cout << "Sugar: " << ceil(totalSugar / 950) << endl << "Flour: " << ceil(totalFlour / 750) << endl
  27.         << "Max used flour is " << maxFlour << " grams, max used sugar is " << maxSugar << " grams.\n";
  28.  
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement