Advertisement
veselka_a

5.EasterBread

Feb 24th, 2020
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.45 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _5.EasterBread
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int easterBread = int.Parse(Console.ReadLine());
  14.             int maxShugarGr = 0;
  15.             int maxFlourGr = 0;
  16.             double totalShugerGr = 0.0;
  17.             double totalFlourGr = 0.0;
  18.             int packShugarGr = 950;
  19.             int packFlourGr = 750;
  20.            
  21.  
  22.             for (int i = 0; i < easterBread; i++)
  23.             {
  24.                 int shugarGr = int.Parse(Console.ReadLine());
  25.                 int flourGr = int.Parse(Console.ReadLine());
  26.                 totalShugerGr += shugarGr;
  27.                 totalFlourGr += flourGr;
  28.  
  29.                 if (shugarGr>maxShugarGr)
  30.                 {
  31.                     maxShugarGr = shugarGr;
  32.                 }
  33.                 if (flourGr>maxFlourGr)
  34.                 {
  35.                     maxFlourGr = flourGr;
  36.                 }
  37.  
  38.             }
  39.      
  40.             int packShugar = (int)Math.Ceiling(totalShugerGr / packShugarGr);
  41.             Console.WriteLine($"Sugar: {packShugar}");
  42.  
  43.             int packFlour = (int)Math.Ceiling(totalFlourGr / packFlourGr);
  44.             Console.WriteLine($"Flour: {packFlour}");
  45.  
  46.             Console.WriteLine($"Max used flour is {maxFlourGr} grams, max used sugar is {maxShugarGr} grams.");
  47.         }
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement