Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace _01Santa_sCookies
- {
- class Program
- {
- static void Main(string[] args)
- {
- int batches = int.Parse(Console.ReadLine());
- int totalBoxes = 0;
- for (int i = 0; i < batches; i++)
- {
- int flourInGr = int.Parse(Console.ReadLine());
- int sugarInGr = int.Parse(Console.ReadLine());
- int cocoaInGr = int.Parse(Console.ReadLine());
- int flourCaps = flourInGr / 140;
- int sugarSpoons = sugarInGr / 20;
- int cocoaSpoons = cocoaInGr / 10;
- if (flourCaps<=0 || sugarSpoons<=0 || cocoaSpoons<=0)
- {
- Console.WriteLine("Ingredients are not enough for a box of cookies.");
- continue;
- }
- double cocoaSpoonsCalculated = cocoaSpoons / 25.0;
- double sugarSpoonsCalculated = sugarSpoons / 25.0;
- double flourSpoonsCalculated = flourCaps / 25.0;
- double firstMin = Math.Min(flourSpoonsCalculated, sugarSpoonsCalculated);
- double finalMin = Math.Min(firstMin, cocoaSpoonsCalculated);
- double cookiesPerBake =Math.Floor(170 * finalMin);
- int boxesOfCookiesPerBake =(int) cookiesPerBake / 5;
- Console.WriteLine($"Boxes of cookies: {boxesOfCookiesPerBake}");
- totalBoxes += boxesOfCookiesPerBake;
- }
- Console.WriteLine($"Total boxes: {totalBoxes}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement