Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _5.EasterBread
- {
- class Program
- {
- static void Main(string[] args)
- {
- int easterBread = int.Parse(Console.ReadLine());
- int maxShugarGr = 0;
- int maxFlourGr = 0;
- double totalShugerGr = 0.0;
- double totalFlourGr = 0.0;
- int packShugarGr = 950;
- int packFlourGr = 750;
- for (int i = 0; i < easterBread; i++)
- {
- int shugarGr = int.Parse(Console.ReadLine());
- int flourGr = int.Parse(Console.ReadLine());
- totalShugerGr += shugarGr;
- totalFlourGr += flourGr;
- if (shugarGr>maxShugarGr)
- {
- maxShugarGr = shugarGr;
- }
- if (flourGr>maxFlourGr)
- {
- maxFlourGr = flourGr;
- }
- }
- int packShugar = (int)Math.Ceiling(totalShugerGr / packShugarGr);
- Console.WriteLine($"Sugar: {packShugar}");
- int packFlour = (int)Math.Ceiling(totalFlourGr / packFlourGr);
- Console.WriteLine($"Flour: {packFlour}");
- Console.WriteLine($"Max used flour is {maxFlourGr} grams, max used sugar is {maxShugarGr} grams.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement