Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace BakingCompetition
- {
- class Program
- {
- static void Main(string[] args)
- {
- int bakers = int.Parse(Console.ReadLine());
- int totalSweets = 0;
- double totalSum = 0;
- for (int i = 0; i < bakers; i++)
- {
- string baker = "";
- int cookies = 0, cakes = 0, waffles = 0;
- while (true)
- {
- string command = Console.ReadLine();
- if (command == "Stop baking!")
- {
- break;
- }
- if (baker == "")
- {
- baker = command;
- }
- else
- {
- string sweet = command;
- int sweetCount = int.Parse(Console.ReadLine());
- if (sweet == "cookies")
- {
- cookies += sweetCount;
- }
- else if (sweet == "cakes")
- {
- cakes += sweetCount;
- }
- else
- {
- waffles += sweetCount;
- }
- totalSweets += sweetCount;
- }
- }
- totalSum += 1.50 * cookies + 7.80 * cakes + 2.30 * waffles;
- Console.WriteLine($"{baker} baked {cookies} cookies, {cakes} cakes and {waffles} waffles.");
- }
- Console.WriteLine($"All bakery sold: {totalSweets}\nTotal sum for charity: {totalSum:f2} lv.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement