Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int minKozunaci = 0;
- int maxKozunaci = 100;
- int minIngredients = 1;
- int maxIngredients = 10000;
- int kozunaciCount = int.Parse(Console.ReadLine());
- int sugar = 950;
- int flour = 750;
- if (kozunaciCount < minKozunaci || kozunaciCount > maxKozunaci)
- {
- return;
- }
- //if (quantitySugar < minIngredients || quantitySugar > maxIngredients)
- //{
- // return;
- //}
- //if (quantityFlour < minIngredients || quantityFlour > maxIngredients)
- //{
- // return;
- //}
- int allSugar = 0;
- int allFlour = 0;
- int maxSugar = 0;
- int maxFlour = 0;
- while (kozunaciCount > 0)
- {
- int quantitySugar = int.Parse(Console.ReadLine());
- int quantityFlour = int.Parse(Console.ReadLine());
- if (quantitySugar > maxSugar)
- {
- maxSugar = quantitySugar;
- }
- if (quantityFlour > maxFlour)
- {
- maxFlour = quantityFlour;
- }
- allSugar += quantitySugar;
- allFlour += quantityFlour;
- kozunaciCount--;
- }
- double calc1 = (double)allSugar / sugar;
- double sugarPakcs = Math.Ceiling(calc1);
- double calc2 = (double)allFlour / flour;
- double flourPakcs = Math.Ceiling(calc2);
- Console.WriteLine($"Sugar: {sugarPakcs}");
- Console.WriteLine($"Flour: {flourPakcs}");
- Console.WriteLine($"Max used flour is {maxFlour} grams, max used sugar is {maxSugar} grams.");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement