Advertisement
aggressiveviking

Untitled

Feb 19th, 2020
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.20 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _00._TEST
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int kozunatsi = int.Parse(Console.ReadLine());
  10.  
  11.             int totalSugar = 0;
  12.             int totalFloor = 0;
  13.  
  14.             int maxFlour = int.MinValue;
  15.             int maxSugar = int.MinValue;
  16.  
  17.             for (int i = 1; i <= kozunatsi; i++)
  18.             {
  19.                 int sugar = int.Parse(Console.ReadLine());
  20.                 int floor = int.Parse(Console.ReadLine());
  21.  
  22.                 totalFloor += floor;
  23.                 totalSugar += sugar;
  24.  
  25.                 if (floor > maxFlour)
  26.                 {
  27.                     maxFlour = floor;
  28.                 }
  29.  
  30.                 if (sugar > maxSugar)
  31.                 {
  32.                     maxSugar = sugar;
  33.                 }
  34.  
  35.             }
  36.  
  37.  
  38.             double a = Math.Ceiling(totalSugar / 950.0);
  39.             double b = Math.Ceiling(totalFloor / 750.0);
  40.            
  41.            
  42.             Console.WriteLine($"Sugar: {a}");
  43.             Console.WriteLine($"Flour: {b}");
  44.  
  45.             Console.WriteLine($"Max used flour is {maxFlour} grams, max used sugar is {maxSugar} grams.");
  46.  
  47.         }
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement